I don't know why this reverse proxy is not working. I've seen several examples and I can't find anything wrong with it. It logs: If I uncomment the line that redefines the Schema the error message becomes: If I uncomment the line that redefines the host also, then the target server becomes stackoverflow.com (I mean, it never uses "myrealserver.com"). If I ask for mylocalhost.com:8080/somepath (or even /) then I get a 404 from Stackoverflow, no matter if stackoverflow.com/somepath exists or not. It says: It does not translate the Host header automatically. If then I uncomment the line that sets (and the other one that prints) the Header "Host". Then I can read "stackoverflow.com" in the log, but I still get the same 404 page reporting that I am trying to access "mylocalhost.com". How is it that I am supposed to make the program work as a proxy? |
2014/04/18 21:32:51 URL: /favicon.ico 2014/04/18 21:32:51 Scheme: 2014/04/18 21:32:51 Host: 2014/04/18 21:32:51 http: proxy error: unsupported protocol scheme ""
Are you trying to enter proxy address (mylocalhost.com:8080) into the browser address bar? You're doing it wrong.
I didn't really want a double host change. I added a different host just to see wich one worked.
The Director function HAS the functionality and as soon as you override it, you lost it and you have to rewrite it...
But it's not a traditional proxy. It's a SingleHostReverseProxy, so as I understand it, it just sits in front of a web server and serves everything as an alias of the real server.
realDirector := proxy.Directorproxy.Director = func(req *http.Request) {log.Println(req.URL)realDirector(req)}
But now I'm curious about the traditional proxy. OpenNota, (or anyone reading, obviously) can you point me into the right direction on how to make my browser interface with it?
I did set it up as a Proxy for all navigation, but my server is not getting any request... (not even just to let me look at them fail)
Looks like Chrome is still connecting to the Internet directly.