1

In the following example:

http {                                                                        
        server { # simple reverse-proxy                                       
        listen       8080;                                                    
            location / {                                                      
                set $token $arg_token;                                        
                #return 200 $token;                                           
                add_header test "test $token";                                
                proxy_pass http://localhost:5601;                             
            }                                                                 
        } ...
}

if I leave return 200 $token I obtain the token as response + in header (which is a normal behavior) but when I delete return I obtain only "test" as test header value, what am I missing please ?

1 Answer 1

1

The proxy_set_header sets header that NGINX will use while communicating to the upstream/backend.

You won't see that added header in the response of NGINX back to the client.

If you want to see it, use add_header as well.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you for your answer, I've given the wrong example please check my edited question, thank you!
What is the HTTP status when you don't add return? If you app returns non-200 response, then add_header will not apply, unless you add always parameter to it.
What happens if you just use add_header test "test $arg_token"; without set? Your issue might be an order of application for set + add_header + proxy_pass.
the problem is that the test is present it's just the $arg_token (or $token) that doesn't has value I don't understand why, I have test header = "test" without the token
ok that's really weird but it seems that the problem is from kibana, if I try another proxy_pass it works... :(
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.