Rerouting based on content-type of request

sudharshanr nginx-forum at nginx.us
Thu Aug 6 19:04:59 UTC 2015


I'm having a reverse-proxied Nginx server. I wanted to know if it is
possible to redirect the request in Nginx based on the content-type of the
request?

Right now, I'm checking the URL for a keyword, and based on that, I redirect
the request. So it is something like this:

location ~*/(keyword){
     proxy_pass         http://127.0.0.1:6565;
}

But now I have another URL having the same keyword. However, the
content-type of the request will be 'application/json', and I need to
forward that request to port 8080. Is it possible to differentiate between
these two urls? I'm using Nginx 1.6.2.

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260830,260830#msg-260830



More information about the nginx mailing list