hereForLearing
hereForLearing

Reputation: 1298

Nginx passing url arguments as header

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 ?

Upvotes: 1

Views: 975

Answers (1)

Danila Vershinin
Danila Vershinin

Reputation: 9895

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.

Upvotes: 1

Related Questions