change reverse url
This commit is contained in:
6
main.go
6
main.go
@@ -10,7 +10,9 @@ import (
|
|||||||
func fetchHandler(w http.ResponseWriter, r *http.Request) {
|
func fetchHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
path := r.URL.Path
|
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)
|
rpURL, _ := url.Parse(path)
|
||||||
|
|
||||||
@@ -18,7 +20,7 @@ func fetchHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
director := proxy.Director
|
director := proxy.Director
|
||||||
proxy.Director = func(r *http.Request) {
|
proxy.Director = func(r *http.Request) {
|
||||||
director(r)
|
director(r)
|
||||||
r.Host = "gravatar.com"
|
r.Host = "secure.gravatar.com"
|
||||||
}
|
}
|
||||||
proxy.ServeHTTP(w, r)
|
proxy.ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user