reverse proxy returns Not found or Forbidden Errors

60 views
Skip to first unread message

Nizar AYARI

unread,
Sep 17, 2018, 6:08:34 PM9/17/18
to golang-nuts

I'm trying to create a reverse proxy that takes all requests and redirect them into a target url, like google.com or any other API. Unfortunately, all targets returns errors like page Not Found, or Forbidden Error.


Please see the source code here:


https://stackoverflow.com/questions/52374659/golang-reverse-proxy-returns-not-found-or-forbidden-errors


I spent many days trying to set appropriate headers but nothing worked so far. I think the headers were not set correctly but I don't how to copy headers from client and add it to the proxy.

I'm using a proxy instead of a redirect because I have to do some work with the body request and response!

Thanks in advance!

Dean Wang

unread,
Sep 18, 2018, 8:49:34 AM9/18/18
to golang-nuts
I ran your code and  it seems ok.

1.PNG




在 2018年9月18日星期二 UTC+8上午6:08:34,Nizar AYARI写道:
Reply all
Reply to author
Forward
0 new messages