Welcome! Log In Create A New Profile

Advanced

RE: Setting a custom header based on another upstream/sent header

Reinis Rozitis
August 22, 2019 08:28AM
> Is this expected behaviour? Could there be another way to do this?

'if' (the rewrite module) is executed in early stages when $sent_* variables are not available that’s why the regex doesn't match.

What you could do is use 'map' instead:
(http://nginx.org/en/docs/http/ngx_http_map_module.html )


map $sent_http_link $IS_WORDPRESS {
~*.*wp-json.* "true";
default "false";
}

And then:

add_header X-Is-WordPress $IS_WORDPRESS;

rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Setting a custom header based on another upstream/sent header

fevangelou August 22, 2019 08:00AM

RE: Setting a custom header based on another upstream/sent header

Reinis Rozitis August 22, 2019 08:28AM

Re: RE: Setting a custom header based on another upstream/sent header

fevangelou August 22, 2019 11:25AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready