- Previous thread: nginx manpage
- Next thread: ngx_http_secure_link_module after ngx_http_rewrite_module
- Threads sorted by date: nginx 200911
Hi, folks!
After two days' work, I've now got the "headers_more" module passing
the its own test suite. This is an enhanced version of the standard
"headers" module because it provides more utilities like resetting or
clearing output headers. Builtin headers, like "Content-Type",
"Content-Length", and "Server", are also manipulatable ;)
It also allows you to specify an optional HTTP status code criteria
using the -s option and an optional content type criteria using the -t
option.
Here's some random use cases:
more_set_headers 'Server: my-server';
location /foo {
more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
more_set_headers -s '400 404 500 503' 'Foo: Bar';
more_clear_headers 'Transfer-Encoding' 'Content-Type';
}
location /type {
more_set_headers 'Content-Type: text/plain';
}
One important TODO is to allow variables within the new headers'
values. That's where "headers_more" is "less" than the standard
"headers" module :P
The Git source repository is here:
http://github.com/agentzh/headers-more-nginx-module
And you're recommended to use the tarballs for the tagged releases:
http://github.com/agentzh/headers-more-nginx-module/downloads
Don't hesitate to report any issues that you find ;)
Enjoy!
-agentzh
After two days' work, I've now got the "headers_more" module passing
the its own test suite. This is an enhanced version of the standard
"headers" module because it provides more utilities like resetting or
clearing output headers. Builtin headers, like "Content-Type",
"Content-Length", and "Server", are also manipulatable ;)
It also allows you to specify an optional HTTP status code criteria
using the -s option and an optional content type criteria using the -t
option.
Here's some random use cases:
more_set_headers 'Server: my-server';
location /foo {
more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
more_set_headers -s '400 404 500 503' 'Foo: Bar';
more_clear_headers 'Transfer-Encoding' 'Content-Type';
}
location /type {
more_set_headers 'Content-Type: text/plain';
}
One important TODO is to allow variables within the new headers'
values. That's where "headers_more" is "less" than the standard
"headers" module :P
The Git source repository is here:
http://github.com/agentzh/headers-more-nginx-module
And you're recommended to use the tarballs for the tagged releases:
http://github.com/agentzh/headers-more-nginx-module/downloads
Don't hesitate to report any issues that you find ;)
Enjoy!
-agentzh
On Tue, Nov 17, 2009 at 6:00 PM, agentzh wrote:
> One important TODO is to allow variables within the new headers'
> values. That's where "headers_more" is "less" than the standard
> "headers" module :P
>
Okay, I've just shamelessly stolen the implementation directly from
the standard "headers" module, and made variables-in-header-values
work as expected. For example,
set $my_server 'Super Star Server';
more_set_headers 'Server: $my_server';
This feature is now included in v0.02:
http://github.com/agentzh/headers-more-nginx-module/downloads
But another TODO comes into my mind: adding support for input headers!
Stay tuned :)
Have fun!
-agentzh
> One important TODO is to allow variables within the new headers'
> values. That's where "headers_more" is "less" than the standard
> "headers" module :P
>
Okay, I've just shamelessly stolen the implementation directly from
the standard "headers" module, and made variables-in-header-values
work as expected. For example,
set $my_server 'Super Star Server';
more_set_headers 'Server: $my_server';
This feature is now included in v0.02:
http://github.com/agentzh/headers-more-nginx-module/downloads
But another TODO comes into my mind: adding support for input headers!
Stay tuned :)
Have fun!
-agentzh
Hey agentzh,
Very nice module. Good job and thanks!
On Tue, Nov 17, 2009 at 6:00 PM, agentzh wrote:
> Hi, folks!
>
> After two days' work, I've now got the "headers_more" module passing
> the its own test suite. This is an enhanced version of the standard
> "headers" module because it provides more utilities like resetting or
> clearing output headers. Builtin headers, like "Content-Type",
> "Content-Length", and "Server", are also manipulatable ;)
>
> It also allows you to specify an optional HTTP status code criteria
> using the -s option and an optional content type criteria using the -t
> option.
>
> Here's some random use cases:
>
> more_set_headers 'Server: my-server';
>
> location /foo {
> more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
> more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
> more_set_headers -s '400 404 500 503' 'Foo: Bar';
> more_clear_headers 'Transfer-Encoding' 'Content-Type';
> }
>
> location /type {
> more_set_headers 'Content-Type: text/plain';
> }
>
> One important TODO is to allow variables within the new headers'
> values. That's where "headers_more" is "less" than the standard
> "headers" module :P
>
> The Git source repository is here:
>
> http://github.com/agentzh/headers-more-nginx-module
>
> And you're recommended to use the tarballs for the tagged releases:
>
> http://github.com/agentzh/headers-more-nginx-module/downloads
>
> Don't hesitate to report any issues that you find ;)
>
> Enjoy!
> -agentzh
>
>
--
Joshua Zhu
http://www.zhuzhaoyuan.com
Very nice module. Good job and thanks!
On Tue, Nov 17, 2009 at 6:00 PM, agentzh wrote:
> Hi, folks!
>
> After two days' work, I've now got the "headers_more" module passing
> the its own test suite. This is an enhanced version of the standard
> "headers" module because it provides more utilities like resetting or
> clearing output headers. Builtin headers, like "Content-Type",
> "Content-Length", and "Server", are also manipulatable ;)
>
> It also allows you to specify an optional HTTP status code criteria
> using the -s option and an optional content type criteria using the -t
> option.
>
> Here's some random use cases:
>
> more_set_headers 'Server: my-server';
>
> location /foo {
> more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo';
> more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo';
> more_set_headers -s '400 404 500 503' 'Foo: Bar';
> more_clear_headers 'Transfer-Encoding' 'Content-Type';
> }
>
> location /type {
> more_set_headers 'Content-Type: text/plain';
> }
>
> One important TODO is to allow variables within the new headers'
> values. That's where "headers_more" is "less" than the standard
> "headers" module :P
>
> The Git source repository is here:
>
> http://github.com/agentzh/headers-more-nginx-module
>
> And you're recommended to use the tarballs for the tagged releases:
>
> http://github.com/agentzh/headers-more-nginx-module/downloads
>
> Don't hesitate to report any issues that you find ;)
>
> Enjoy!
> -agentzh
>
>
--
Joshua Zhu
http://www.zhuzhaoyuan.com
On Wed, Nov 18, 2009 at 10:18 AM, agentzh wrote:
>
> But another TODO comes into my mind: adding support for input headers!
> Stay tuned :)
>
Okay, the input header support has finally landed in v0.05 after a few
hours' big refactoring and hacking. Here's some funny examples:
location /foo {
set $my_host 'my dog';
more_set_input_headers 'Host: $my_host';
more_set_input_headers -t 'text/plain' 'X-Foo: bah';
# now $host and $http_host have their new values...
}
The "input header filter" runs in the access phase. I'm not sure if
it's completely right but this phase lets me pass all the related
tests in
http://github.com/agentzh/headers-more-nginx-module/blob/master/test/t/input.t
and
http://github.com/agentzh/headers-more-nginx-module/blob/master/test/t/vars.t
while other phases break things horribly :)
Theoretically it should also work with subrequests. But unfortunately
the ngx_http_subrequest function in the core seems to be buggy
regarding r->headers_in handling IIRC. So be careful with that :)
I'll work on the wiki page for this module soon.
Enjoy!
-agentzh
>
> But another TODO comes into my mind: adding support for input headers!
> Stay tuned :)
>
Okay, the input header support has finally landed in v0.05 after a few
hours' big refactoring and hacking. Here's some funny examples:
location /foo {
set $my_host 'my dog';
more_set_input_headers 'Host: $my_host';
more_set_input_headers -t 'text/plain' 'X-Foo: bah';
# now $host and $http_host have their new values...
}
The "input header filter" runs in the access phase. I'm not sure if
it's completely right but this phase lets me pass all the related
tests in
http://github.com/agentzh/headers-more-nginx-module/blob/master/test/t/input.t
and
http://github.com/agentzh/headers-more-nginx-module/blob/master/test/t/vars.t
while other phases break things horribly :)
Theoretically it should also work with subrequests. But unfortunately
the ngx_http_subrequest function in the core seems to be buggy
regarding r->headers_in handling IIRC. So be careful with that :)
I'll work on the wiki page for this module soon.
Enjoy!
-agentzh
On Wed, Nov 18, 2009 at 3:48 PM, agentzh wrote:
>
> I'll work on the wiki page for this module soon.
>
As promised, I've added detailed documentation to the following wiki page:
http://wiki.nginx.org/NginxHttpHeadersMoreModule
Thanks Cliff Wells for providing such an excellent facility that makes
me much more motivated to write documentation :)
Cheers,
-agentzh
>
> I'll work on the wiki page for this module soon.
>
As promised, I've added detailed documentation to the following wiki page:
http://wiki.nginx.org/NginxHttpHeadersMoreModule
Thanks Cliff Wells for providing such an excellent facility that makes
me much more motivated to write documentation :)
Cheers,
-agentzh
agentzh Wrote:
-------------------------------------------------------
>
> http://wiki.nginx.org/NginxHttpHeadersMoreModule
>
> Thanks Cliff Wells for providing such an excellent
> facility that makes
> me much more motivated to write documentation :)
>
Great work.. this will be invaluable for conditionally adding keywords like "public" to Cache-Control headers (which is necessary for clients to persistently cache SSL resources in most browsers). Should drastically simplify configuration files.
Does anyone know if there any plans to move the "headers_more" module (or any of the others) into the mainline nginx code base? It would be very nice to have this in a stable release someday...
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,23460,27968#msg-27968
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
-------------------------------------------------------
>
> http://wiki.nginx.org/NginxHttpHeadersMoreModule
>
> Thanks Cliff Wells for providing such an excellent
> facility that makes
> me much more motivated to write documentation :)
>
Great work.. this will be invaluable for conditionally adding keywords like "public" to Cache-Control headers (which is necessary for clients to persistently cache SSL resources in most browsers). Should drastically simplify configuration files.
Does anyone know if there any plans to move the "headers_more" module (or any of the others) into the mainline nginx code base? It would be very nice to have this in a stable release someday...
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,23460,27968#msg-27968
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Related Threads
- [gcc-in-cxx] Avoid goto in gcov.c - gcc
- [Bug target/39119] New: Update classification of aggregates with __m256 - gcc
- [python-win32] OT: MS Office Addin -- Guidance/Advice - python
- result_attribute on ldap query - postfix
- [users] line shadow in spreadsheet line graphs - openoffice
- how to invoke a exe(eg.vlc.exe) using ruby script - ruby
- [ruby-core:22597] [Bug #1227] [BUG] object allocation during garbage collection phase - ruby