7

I have set up a very basic proxy rule in nginx. However the resources where the request are proxyed do a referer check. It must be the same domain the service is running at. I therefore need to change the referer. I tried a proxy_set_header but that doesn´t seem to work.

Am I missing something or is there any other way to do this?

location /api/v1/ { proxy_pass http://192.168.10.10:8080; proxy_set_header Referer "http://192.168.10.10"; } 
1
  • Were you able to find a workaround? Commented Mar 31, 2017 at 19:04

2 Answers 2

5

You say that the proxied server asks for a domain name as a referer. Try that domain name instead of IP address.

proxy_set_header Referer "http://proxied-domain-here.com"; 
2
  • Thanks for this. I was having a similar issue, which was solved by quoting the new referer string and adding "http://" to the beginning. Commented May 9, 2018 at 19:57
  • This can be a bad idea for CSRF. However, nginx doesn't seem to provide a way to edit the referer header. Commented Jun 5, 2018 at 17:54
2

Few years later, but this could be helpful to somewhere, you miss the port at the referer header (:8080):

 proxy_set_header Referer "http://192.168.10.10:8080"; 

I hope can be helpful.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.