# How to tell Nginx not to decode URL for proxy\_pass?

**URL:** <https://www.ruby-forum.com/t/how-to-tell-nginx-not-to-decode-url-for-proxy-pass/236916>\
**Category:** NGINX\
**Created:** [October 11, 2013, 3:24am UTC](https://www.ruby-forum.com/t/how-to-tell-nginx-not-to-decode-url-for-proxy-pass/236916 "2013-10-11T03:24:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 11, 2013, 3:24am UTC](https://www.ruby-forum.com/t/how-to-tell-nginx-not-to-decode-url-for-proxy-pass/236916/1 "2013-10-11T03:24:24Z")

</div>

Hi,

I need to pass a certain URI namespace to an upstream servers, while  
taking  
away the prefix. Consider following configuration:

```
location ^~ /going-to-upstream/ {
    access_log off;
    rewrite /upstream(/.*) $1 break;
    proxy_pass http://upstream;
}

location / {
    # Actual server
}

```

So, whenever I will get a request to  
[http://server/going-to-upstream/something](http://server/going-to-upstream/something) → I should have a request in  
my  
upstream server for “/something”. And I do.

However, as soon as the upstream part has something urlencoded, for  
example  
an url, nginx decodes the url and passes it in decoded format to the  
upstream. An example:

[http://server/going-to-upstream/something/http%3A%2F%2Fserver%2F](http://server/going-to-upstream/something/http%3A%2F%2Fserver%2F)  
will cause an upstream request “/something/[http://server/](http://server/)” while I would  
need literally “/something/http%3A%2F%2Fserver%2F”

How could I make the nginx to not decode the URI in rewrite?

(My actual use case is related to using Thumbor, see  
[How Yipit Scales Thumbnailing with Thumbor and Cloudfront - Yipit Django Blog](http://tech.yipit.com/2013/01/03/how-yipit-scales-thumbnailing-with-thumbor-and-cloudfront/).  
They have a dedicated nginx server { } for this, but I need to use an  
existing to make Thumbor urls to live under our main application  
domain.)

Best regards,  
Ville
