Hello, I’m experimenting with having nginx prepare the request to my
application server in such way I can avoid implementing a router
In this example, I tried to simulate rails’ restful routes for a blog
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?