Modify

Opened 7 years ago

Closed 5 years ago

#1771 closed defect (worksforme)

"The page isn't redirecting properly" Error

Reported by: anonymous Owned by: BladeHawke
Priority: normal Component: AuthRequiredPlugin
Severity: major Keywords:
Cc: Trac Release: 0.11

Description

As of 0.3 I am getting a bad redirection error. I am using trac 10.4 and firefox.

My trac is installed at:
http://mywebhost/trac/imasys/

When I hit the url, the address bar says this:
http://mywebhost/trac/imasys/trac/imasys/login?referer=http%3A%2F%2Fgamma.ima.museum%2Ftrac%2Fimasys%2Ftrac%2Fimasys%2Flogin

Attachments (0)

Change History (13)

comment:1 Changed 7 years ago by anonymous

  • Cc cwmoad@… added

comment:2 Changed 7 years ago by cwmoad@…

  • Cc cwmoad@… removed

comment:3 Changed 7 years ago by anonymous

This looks like a trac configuration error. The plugin's redirect redirects to the trac installation's login page. This type of error can be a result of incorrect Apache configuration and/or errors in trac.ini.

Please uninstall the plugin and click the login link in the navigation contributors. I suspect you will get the same result.

comment:4 Changed 7 years ago by BladeHawke

Err.. The above was me

comment:5 Changed 7 years ago by cwmoad@…

This line seems to be the culprit for me:

req.redirect(self.env.href(req.href.login(), {'referer':req.abs_href(req.path_info)}))

"req.href.login()" returns "/trac/imasys/login" and the "self.env.href" function appends an additional "/trac/imasys" to the beginning of the url. I am not sure what configuration problem could be causing the error. I just changed the above line to:

req.redirect(self.env.href('login/', {'referer':req.abs_href(req.path_info)}))

... and it works for me. This might be accounting for my "misconfiguration" though.

Thoughts?

comment:6 Changed 7 years ago by BladeHawke

This sounds plausible. In order to determine possible configuration issues I will need some information. (Essentially, before I decide that this is indeed broken, I need to be certain that there isn't a configuration issue causing this.)

What I need are the sections of your httpd.conf responsible for serving trac (everything in the <Location (trac_location)/> ... </Location>) and the [project] and [trac] sections of your trac.ini.

I do not currently have anyplace to set up a test trac to debug this issue, so will be somewhat dependant on you and the reporter of #1777 to test :/

comment:7 Changed 7 years ago by cwmoad@…

http.conf

<Location "/trac">
  SetHandler mod_python
  PythonHandler trac.web.modpython_frontend
  PythonOption TracEnvParentDir /var/lib/trac
  PythonOption TracUriRoot /trac
</Location>

Project config

[project]
descr = Systems information for the ***********************.
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
icon = /ima-logo.ico
name = IMA System Information
url = http://*****.***.******/trac/imasys

Trac config

[trac]
authz_file =
authz_module_name =
base_url = http://*****.***.******/trac/imasys
check_auth_ip = true
database = sqlite:db/trac.db
default_charset = iso-8859-15
default_handler = WikiModule
htdocs_location =
ignore_auth_case = false
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,settings,help,about
permission_store = DefaultPermissionStore
repository_dir = /var/lib/svn/ima
repository_type = svn
timeout = 20

comment:8 Changed 7 years ago by BladeHawke

Okay, I've managed to take a look at this. Please try the following:

  • 0.10/tracauthrequired/authrequired.py

     
    5454        self.log.debug('Redirecting anonymous request to /login') 
    5555        #req.redirect(req.href.login()) 
    5656        # Testing new redirect syntax.  Thanks to jfernandez@ist.psu.edu 
    57         req.redirect(self.env.href(req.href.login(), {'referer':req.abs_href(req.path_info)})) 
     57        req.redirect(req.href.login(), {'referer':req.abs_href(req.path_info)}) 
    5858        return [] # We don't really get here, but what the heck... 

While your workaround works, we don't really want to hardcode /login as it is possible that some patch, future update, or another plugin could change the login url from /login. I have verified that the above does work in trac installs on the root of the vhost (i.e. https://trac.example.org/)

comment:9 Changed 7 years ago by cwmoad@…

  • Resolution set to fixed
  • Status changed from new to closed

The hard-code was my quick check. Your patch works fine.

Thanks,

Charlie

comment:10 Changed 7 years ago by BladeHawke

(In [2462]) Removed spurious self.env.href() that caused redirection issues on trac installation not at root of vhost. (fixes #1771)

comment:11 Changed 6 years ago by richard

In 0.11, this line should be:

- req.redirect(req.href.login(), {'referer':req.abs_href(req.path_info)}) 
+ req.redirect(req.href.login(referer = req.abs_href(req.path_info)))

comment:12 Changed 5 years ago by sdistefano@…

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Trac Release changed from 0.10 to 0.11

I am having this same problem, but cannot find "tracauthrequired/authrequired.py" to make the change. I started with vers 10.4 and upgraded to vers 11.

Any ideas where this file is located?

Thanks,

S

comment:13 Changed 5 years ago by anonymous

  • Resolution set to worksforme
  • Status changed from reopened to closed

nm, I fixed, recreated the user's acct.

thanks anyway.

S

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.