# Rerouting based on content-type of request

**URL:** <https://www.ruby-forum.com/t/rerouting-based-on-content-type-of-request/242910>\
**Category:** NGINX\
**Created:** [August 6, 2015, 9:05pm UTC](https://www.ruby-forum.com/t/rerouting-based-on-content-type-of-request/242910 "2015-08-06T21:05:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 6, 2015, 9:05pm UTC](https://www.ruby-forum.com/t/rerouting-based-on-content-type-of-request/242910/1 "2015-08-06T21:05:41Z")

</div>

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](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:

> **[Rerouting based on content-type of request](https://forum.nginx.org/read.php?2,260830,260830#msg-260830)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![sudharshanr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f05b48/32.png) [@sudharshanr](https://www.ruby-forum.com/u/sudharshanr)\
**Post date:** [August 6, 2015, 9:47pm UTC](https://www.ruby-forum.com/t/rerouting-based-on-content-type-of-request/242910/2 "2015-08-06T21:47:45Z")

</div>

Close enough: [Override Content-Type header with proxied requests](http://forum.nginx.org/read.php?2,239473,239473#msg-239473)

Posted at Nginx Forum:

> **[Re: Rerouting based on content-type of request](https://forum.nginx.org/read.php?2,260830,260831#msg-260831)**
>
> 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...
