Modify

Opened 15 years ago

Last modified 9 years ago

#4963 new defect

Redirection problem with different hostnames in NAT

Reported by: angel Owned by: ejucovy
Priority: normal Component: PermRedirectPlugin
Severity: major Keywords:
Cc: Trac Release: 0.11

Description

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.

Attachments (0)

Change History (5)

comment:1 Changed 12 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

     
    2525           
    2626            exctype, exc = sys.exc_info()[0:2]
    2727
    28             ref_url = req.base_url + req.path_info
    29             if req.query_string:
    30                 ref_url = ref_url + "?" + req.query_string
     28            ref_url = req.href(req.path_info, req.arg_list)
    3129            login_url = req.href.login(referer=ref_url)
    3230
    3331            if issubclass(exctype, PermissionError):

comment:2 Changed 11 years ago by ejucovy

Owner: changed from Noah Kantrowitz to ejucovy
Summary: Redirection problem with different hostnamesRedirection 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 10 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 9 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 9 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
Set your email in Preferences
Action
as new The owner will remain ejucovy.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.