ascobol
ascobol

Reputation: 7696

When to use route_url or route_path in Pyramid?

I have an issue with route_url and my setup. On the server I have a paster server which listen on 127.0.0.1 on port 6543 and a nginx server which does reverse proxying from port 80 to port 6543.

I'm also using paste prefix to retrieve the real client IP with this setup in my ini file:

[filter:paste_prefix]
use = egg:PasteDeploy#prefix

[pipeline:main]
pipeline = 
  paste_prefix
  myapp

The server is on a private LAN and I'm trying to connect to the server through a SSH tunnel set up as this:

ssh me@sshgateway -L 8080:nginx_server_ip:80

And I connect to the web page on my client at this url: http://localhost:8080

The main page is displayed correctly but then all links generated with request.route_url are redirecting to localhost/url (without the :8080). I guess this have something to do either with nginx or paste prefix (or both).

I hope that replacing route_url with route_path will probably solve this problem without fixing the nginx/ini setup issue.

Is there any reason to call route_url instead of route_path, ever ?

Upvotes: 2

Views: 1236

Answers (1)

Michael Merickel
Michael Merickel

Reputation: 23331

route_url is useful in situations like generating a redirect from HTTP to HTTPS, or to a different subdomain. Other than that route_path is probably preferable.

Upvotes: 3

Related Questions