I want to pass some headers that are retrieved from one location
and pass them via a redirect to the user's localhost. However, I cannot see the headers. Is this possible and if so, how do I do it?
Here is a location where we add a header then call rewrite
:
location = /proxy-localhost/9000 {
// in due course, I will pass other headers, but for now let's just pass this
add_header 'Dummy' "dummy_val";
rewrite ^ http://localhost:9000;
}
However, when I run a simple server using ncat
on localhost, I don't see a header called Dummy
in the output when I trigger the /proxy-localhost
location block via a curl request (I can see the rewrite
being actioned in the logs, so I know the block is being triggered):
$ for i in {1..3}; do echo -e "HTTP/1.1 200 OK\n\nOK" | ncat -vv -l 9000; done
0 Answers