mirror of
https://git.phreedom.club/localhost_frssoft/compy.git
synced 2024-11-19 14:49:16 +00:00
fix http requests over https proxy connection
Reconstruct the schema of the proxied request if it's not filled out.
This commit is contained in:
parent
a4a691b7b8
commit
fd53c9cb8c
|
@ -66,7 +66,11 @@ func (p *Proxy) handle(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
||||||
func forward(r *http.Request) (*http.Response, error) {
|
func forward(r *http.Request) (*http.Response, error) {
|
||||||
if r.URL.Scheme == "" {
|
if r.URL.Scheme == "" {
|
||||||
|
if r.TLS != nil && r.TLS.ServerName == r.Host {
|
||||||
r.URL.Scheme = "https"
|
r.URL.Scheme = "https"
|
||||||
|
} else {
|
||||||
|
r.URL.Scheme = "http"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if r.URL.Host == "" {
|
if r.URL.Host == "" {
|
||||||
r.URL.Host = r.Host
|
r.URL.Host = r.Host
|
||||||
|
|
Loading…
Reference in a new issue