# uWSGI & pylons URL problem

**URL:** <https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643>\
**Category:** NGINX\
**Created:** [August 3, 2010, 4:12pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643 "2010-08-03T16:12:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 3, 2010, 4:12pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/1 "2010-08-03T16:12:30Z")

</div>

Hi all

I tried to setup nginx with the uwgsi module to a pylons application  
which runs via the uWGSI Server according to following tutorial:  
[http://tonylandis.com/python/deployment-howt-pylons-nginx-and-uwsgi/](http://tonylandis.com/python/deployment-howt-pylons-nginx-and-uwsgi/)

However when i try to access the pylons application all links which were  
created with the pylon’s url object are messed up (double slash “//” at  
the beginning instead of one slash “/”)

If i use following code to generate the url for the current pylons  
“page”:

```auto
${h.url.current()}
```

I get “//CURRENT\_URL” instead of “/CURRENT\_URL”

I tried it even with a fresh pylons app, to make sure that none of my  
routing entries are responsible for this behavior.  
It seems that the SCRIPT\_NAME “/” is added at the beginning of each URL  
somehow.

I don’t think my problem is related to the uWSGI Server because when i  
try to access the uWSGI served pylons app via Cherokee the links are  
fine.

I would be thankful for any ideas or hints.

I used following versions:

nginx: 0.8.47-0  
uWSGI: 0.9.5.4  
pylons: 1.0 (but same problem with 0.9.7)

Thanks in advance

Posted at Nginx Forum:

> **[uWSGI & pylons URL problem](https://forum.nginx.org/read.php?2,116092,116092#msg-116092)**
>
> Hi all I tried to setup nginx with the uwgsi module to a pylons application which runs via the uWGSI Server according to following tutorial: http://tonylandis.com/python/deployment-howt-pylons-nginx-and-uwsgi/ However when i try to access the pylons...

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 3, 2010, 4:30pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/2 "2010-08-03T16:30:04Z")

</div>

Il giorno 03/ago/2010, alle ore 16.11, timeu ha scritto:

> If i use following code to generate the url for the current pylons  
> It seems that the SCRIPT\_NAME “/” is added at the beginning of each URL  
> somehow.

This is an issue signalled by Andrey Petrov and fixed in the current  
mercurial repository (you can check it in the mailing list archive).

I hope to release a maintainance version of the 0.9.5 tree asap.

Roberto De Ioris

> **[unbit - Overview](https://github.com/unbit)**
>
> makers of uWSGI and many more open source projects - unbit

JID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 3, 2010, 4:37pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/3 "2010-08-03T16:37:41Z")

</div>

On Tue, Aug 03, 2010 at 10:11:36AM -0400, timeu wrote:

> If i use following code to generate the url for the current pylons  
> It seems that the SCRIPT\_NAME “/” is added at the beginning of each URL  
> nginx: 0.8.47-0  
> uWSGI: 0.9.5.4  
> pylons: 1.0 (but same problem with 0.9.7)

Try to remove  
uwsgi\_param SCRIPT\_NAME /;

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 3, 2010, 5:03pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/4 "2010-08-03T17:03:26Z")

</div>

Il giorno 03/ago/2010, alle ore 16.55, timeu ha scritto:

> Thanks Roberto !
> 
> I was going crazy while trying to figure out what might have been the  
> problem of the wrong URLs 😉
> 
> I couldn’t find the message in the mailing list archive. What  
> description should I search for?
> 
> Thanks in advance

The “useful” discussion started here:

[http://lists.unbit.it/pipermail/uwsgi/2010-July/000484.html](http://lists.unbit.it/pipermail/uwsgi/2010-July/000484.html)

the problem was in the “wrong way” uWSGI uses to manage empty  
SCRIPT\_NAME

–  
Roberto De Ioris

> **[unbit - Overview](https://github.com/unbit)**
>
> makers of uWSGI and many more open source projects - unbit

JID: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 3, 2010, 4:57pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/5 "2010-08-03T16:57:00Z")

</div>

Thanks Roberto !

I was going crazy while trying to figure out what might have been the  
problem of the wrong URLs 😉

I couldn’t find the message in the mailing list archive. What  
description should I search for?

Thanks in advance

> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,116092,116118#msg-116118](http://forum.nginx.org/read.php?2,116092,116118#msg-116118)

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 4, 2010, 1:34pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/6 "2010-08-04T13:34:09Z")

</div>

Hi Igor,

apparantly I wrote a reply but didn’t post it.

I tried that actually but when I remove this entry from the nginx.conf,  
Pylons complains that the SCRIPT\_NAME key in the request dict is missing  
(I can post the error message later)  
If I just add the uwsgi\_param SCRIPT\_NAME entry without the “/” nginx  
wont’t start.

Ãœmit

> Try to remove  
> uwsgi\_param SCRIPT\_NAME /;

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,116092,116469#msg-116469](http://forum.nginx.org/read.php?2,116092,116469#msg-116469)

---

<div class="post-metadata">

**Author:** ![timeu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@timeu](https://www.ruby-forum.com/u/timeu)\
**Post date:** [August 4, 2010, 1:37pm UTC](https://www.ruby-forum.com/t/uwsgi-pylons-url-problem/192643/7 "2010-08-04T13:37:40Z")

</div>

Thanks !

Roberto De Io\>

> The “useful” discussion started here:
> 
> [http://lists.unbit.it/pipermail/uwsgi/2010-July/00](http://lists.unbit.it/pipermail/uwsgi/2010-July/00)  
> 0484.html

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,116092,116470#msg-116470](http://forum.nginx.org/read.php?2,116092,116470#msg-116470)
