-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot remove headers set with add_header and variable value from map in http block #2358
Comments
I checked with debug http://nginx.org/en/docs/debugging_log.html but that wasn't really useful, since the issue is already obvious (and that's also what I see in the debug log that those headers aren't set yet)
|
The add_header directive takes effect after the headers_more and lua content and lua header_filter phase. If you want to use lua code or headers_more directive, please consider the following configuration
According to the execution phase, it is probably as follows, you can verify it again:
Finally, there is a question: do you want to operate on the Cache-Control or Expires header, or both? |
openresty/1.25.3.2
my.lua
At the place marked with
// **
I also tried:=> this doesn't work either - it will only remove the new Expires header I set with the .lua but not the one from http block
What works is using this at
// **
:Then I will only get my Expires header I expected (however all other headers set with add_header are lost/I need to include/set them all there too, which I'd rather avoid)
EDIT: adding
ngx.log( ngx.ALERT, ngx.header["Expires"] )
BEFOREngx.header["Expires"] = nil
results in nil, which means the header isn't set yet, so obviously I can't remove it there.Which goes against what the docs for both ngx.header and
more_clear_headers
say though?The text was updated successfully, but these errors were encountered: