# Proxy\_pass with trailing slash issue

**URL:** <https://www.ruby-forum.com/t/proxy-pass-with-trailing-slash-issue/219834>\
**Category:** NGINX\
**Created:** [May 17, 2012, 8:39pm UTC](https://www.ruby-forum.com/t/proxy-pass-with-trailing-slash-issue/219834 "2012-05-17T20:39:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 17, 2012, 8:39pm UTC](https://www.ruby-forum.com/t/proxy-pass-with-trailing-slash-issue/219834/1 "2012-05-17T20:39:56Z")

</div>

I’m using nginx (0.7.65) as a reverse proxy in front of a bunch of  
Tomcat instances. A couple of years ago, following Igor’s suggestions on  
the mailing list, I made a minor change to the configuration to deal  
with a problem with encoding/decoding with some URLs proxied to Tomcat.  
I appended a forward slash to the proxy\_pass, so instead of having this:

```
 proxy_pass http://backend;

```

I had this:

```
 proxy_pass http://backend/;

```

It fixed the problem. But it had the side-effect (at least I assume it  
was this) of inserting an extraneous leading slash into the proxied URL,  
so that the requests ending up at Tomcat are like this:

“GET //whatever”

It’s not actually breaking anything that I know about at the moment, but  
it’s clearly wrong and I’d like to fix it. How do I change my config so  
that I get the benefits of the trailing slash with proxy\_pass without  
having the extraneous leading slash in the proxied request?

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [May 17, 2012, 9:09pm UTC](https://www.ruby-forum.com/t/proxy-pass-with-trailing-slash-issue/219834/2 "2012-05-17T21:09:48Z")

</div>

Hello!

On Thu, May 17, 2012 at 06:39:15PM +0000, John M. wrote:

> ```
> proxy_pass http://backend/;
> 
> ```
> 
> having the extraneous leading slash in the proxied request?  
> With

```
location / {
    proxy_pass http://backend/;
}

```

there shouldn’t be any extra slashes, even in 0.7.65 which is  
rather old (and it may be good idea to upgrade it anyway). Could  
you please provide full config and some logs which show the  
problem?

Maxim D.

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [May 17, 2012, 9:41pm UTC](https://www.ruby-forum.com/t/proxy-pass-with-trailing-slash-issue/219834/3 "2012-05-17T21:41:59Z")

</div>

On 17/05/12 20:08, Maxim D. wrote:

> problem?

If it’s not the trailing slash which is causing the leading slash in the  
proxied requests, I need to look elsewhere. If I don’t get anywhere,  
I’ll try to produce something a little more informative.

I take your point about upgrading. The problem is that 0.7.65 is  
absolutely rock solid, and is in use in an extremely busy system, so  
there has been little incentive to upgrade! I do think we should do so,  
though.

John
