change reverse url

This commit is contained in:
2022-03-08 16:50:15 +08:00
parent b8bce43354
commit fcc45b1b28

View File

@@ -10,7 +10,9 @@ import (
func fetchHandler(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path
path = fmt.Sprintf("https://gravatar.com%s", path)
path = fmt.Sprintf("https://secure.gravatar.com%s", path)
fmt.Println("need reverse url: ", path)
rpURL, _ := url.Parse(path)
@@ -18,7 +20,7 @@ func fetchHandler(w http.ResponseWriter, r *http.Request) {
director := proxy.Director
proxy.Director = func(r *http.Request) {
director(r)
r.Host = "gravatar.com"
r.Host = "secure.gravatar.com"
}
proxy.ServeHTTP(w, r)
}