Welcome! Log In Create A New Profile

Advanced

setting +input+ headers for an upstream server depending on the request's path+method

Emmanuel Oga
January 09, 2012 04:48PM
Hello, I'm experimenting with having nginx prepare the request to my
application server in such way I can avoid implementing a router
there.

In this example, I tried to simulate rails' restful routes for a blog
post resource:

http://pastie.org/3156651

So if I hit an url like POST /posts, nginx should serve it through the
upstream app, passing the app parameters like:

more_set_input_headers "X-NS: POSTS" "X-ACTION: create";

using headers-more module to set input headers. On my app server,
Instead of parsing the routes, I could just take a look on the headers
to know who should handle the response.

The configuration on that pastie works but is kind of verbose. Also,
I'm not sure how well it would work if I had tens or thousands of
routes (the idea would be to generate the nginx configuration from a
simpler manifest file, so you could define so called 'restfull routes'
without much effort).

Can you think of a better way to do this?

--
--------------------------------------------------------------
EmmanuelOga.com - Software Developer

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

setting +input+ headers for an upstream server depending on the request's path+method

Emmanuel Oga January 09, 2012 04:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 284
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