Setting headers

Joó Ádám adam at jooadam.hu
Fri Sep 25 14:20:41 UTC 2015


Hi,

Something that long bothered me, and perhaps has already been
discussed, but I haven’t found anything on it: why is there no way to
set arbitrary headers without using an extension module? I know that
the `add_header` directive has been augmented with the `always` flag
recently, but there’s still no way to freely change headers. I
personally think this is something that one could expect from a web
server.

My specific scenario is that I want to implement server-side
content-negotiation, by conditionally applying an XSL stylesheet and
changing the content-type accordingly. This really made me jump
through hoops using the built-in modules and in specific cases simply
broke. So I gave in and used Headers More, but now, that HTTP/2
support is out, I would like to use it, Thomes Ward’s PPA, however, is
not yet updated, because the Lua module does not build with the new
release (https://twitter.com/teward001/status/646775480931123201), so
my only option would be compiling from source, but I would prefer no
to lose the benefits of package management.

Is there any way to do this within the confines of the built-in modules?


Thanks,
Ádám



More information about the nginx mailing list