# Proxy\_pass to URL encoded path?

**URL:** <https://www.ruby-forum.com/t/proxy-pass-to-url-encoded-path/188229>\
**Category:** NGINX\
**Created:** [May 8, 2010, 2:06am UTC](https://www.ruby-forum.com/t/proxy-pass-to-url-encoded-path/188229 "2010-05-08T02:06:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![7zark7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/5f9b8f/32.png) [@7zark7](https://www.ruby-forum.com/u/7zark7)\
**Post date:** [May 8, 2010, 2:06am UTC](https://www.ruby-forum.com/t/proxy-pass-to-url-encoded-path/188229/1 "2010-05-08T02:06:46Z")

</div>

Hi,

I’m using proxy\_pass in front of CouchDB, which has file paths which  
contain some URL encoded characters (e.g.  
[http://couch:5984/images[b]%2F[/b]logo.gif](http://couch:5984/images%5Bb%5D%2F%5B/b%5Dlogo.gif))

I am trying to to replace some characters in requests to nginx with the  
URL-encoded equivalent:

[http://localhost/images/logo.gif](http://localhost/images/logo.gif) →   
[http://couch:5984/images[b]%2F[/b]logo.gif](http://couch:5984/images%5Bb%5D%2F%5B/b%5Dlogo.gif)

My attempt was this:

```auto
rewrite ^/images/(.*)$ /images%2F$1 break;

location ^~ /images {
       proxy_pass http://couch:5984;
}
```

However, it looks like proxy\_pass is double-encoding the % character,  
which results in the following CouchDB request:

‘GET’ /images%252Flogo.gif

How might I do the following rewrite?:

[http://localhost/images/logo.gif](http://localhost/images/logo.gif) → [http://couch:5984/images%2Flogo.gif](http://couch:5984/images%2Flogo.gif)

Thanks

Posted at Nginx Forum:

> **[proxy\_pass to URL encoded path?](https://forum.nginx.org/read.php?2,84032,84032#msg-84032)**
>
> Hi, I'm using proxy\_pass in front of CouchDB, which has file paths which contain some URL encoded characters (e.g. http://couch:5984/images\[b\]%2F\[/b\]logo.gif) I am trying to to replace some characters in requests to nginx with the URL-encoded...

---

<div class="post-metadata">

**Author:** ![7zark7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/5f9b8f/32.png) [@7zark7](https://www.ruby-forum.com/u/7zark7)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/proxy-pass-to-url-encoded-path/188229/2 "2010-06-17T16:22:05Z")

</div>

Anyone have an idea on this?

Posted at Nginx Forum:

> **[Re: proxy\_pass to URL encoded path?](https://forum.nginx.org/read.php?2,84032,98176#msg-98176)**
>
> Hi, I'm using proxy\_pass in front of CouchDB, which has file paths which contain some URL encoded characters (e.g. http://couch:5984/images\[b\]%2F\[/b\]logo.gif) I am trying to to replace some characters in requests to nginx with the URL-encoded...
