Opened 8 years ago

# Redirection problem with different hostnames in NAT

Reported by: Owned by: angel ejucovy normal PermRedirectPlugin major 0.11

### Facts

• Server is named lets say 'herbert' with Trac
• Server is in a NAT, port 443 is open and forwarded to herbert
• dyndns account lets say myherbert.dyndns.org
• Trac 0.11, PermRedirect 2.0, AccountManager 0.2.1dev-r5479

### What happens

This only happens when PermRedirect Plugin is enabled.

### comment:1 Changed 5 years ago by ejucovy

I haven't figured out how to reproduce this. That said, PermRedirectPlugin passes the full request path as "referer", including the protocol and hostname. I don't think there's any need for it to do that, and it's possible that it's related to this problem.

If anyone is still experiencing this problem, could you try with this patch (against the plugin's trunk) and see if it makes any difference?

• ## permredirect/filter.py

 exctype, exc = sys.exc_info()[0:2] ref_url = req.base_url + req.path_info if req.query_string: ref_url = ref_url + "?" + req.query_string ref_url = req.href(req.path_info, req.arg_list) login_url = req.href.login(referer=ref_url) if issubclass(exctype, PermissionError):

### comment:2 Changed 5 years ago by ejucovy

Owner: changed from Noah Kantrowitz to ejucovy Redirection problem with different hostnames → Redirection problem with different hostnames in NAT

It would also be useful to know the value of the base_url setting when this occurs.

### comment:3 Changed 3 years ago by Steffen Hoffmann

Reported behaviour should be re-evaluated with a current version of AccountManagerPlugin, because redirection after login has seen substantial changes since 0.2.1dev. Btw 0.2.1dev has been rendered irrelevant due to so many fixed issues, that it seem silly to stay at such an ancient version any longer.

### comment:4 Changed 2 years ago by Vincent Penne <ziggy@…>

Hi,

I am experiencing an issue that seems to be the same. My setting is a bit different though (not NAT but proxy) :

My trac installation is behind a proxy. Trac itself is served with tracd in http, and the proxy serves it to the outside world in https. Only the outside url are used, and so I set trac: base_url to my outside https url. Everything's working without any problem, except for this plugin, which redirect my to the almost right uri but not quite so : it removes the first part of the path, so instead of https://mytrac.org/trac/wiki I'm redirected to https://mytrac.org//wiki which doesn't exist.

I tried the patch in comment:1 , and it does solve my issue.

### comment:5 Changed 2 years ago by Vincent Penne <ziggy@…>

Ok, I just realized that trac: base_url was https://mytrac.org/ instead of https://mytrac.org/trac, if I change it to the latter, it also fixes my problem, without requiring to patch anything this time (I just hope I didn't break anything else, but it doesn't seem so).

### Modify Ticket

Change Properties