Ticket #1771 (closed defect: fixed)

Opened 2 years ago

Last modified 4 months ago

"The page isn't redirecting properly" Error

Reported by: anonymous Assigned to: BladeHawke
Priority: normal Component: AuthRequiredPlugin
Severity: major Keywords:
Cc: Trac Release: 0.10

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

Change History

07/11/07 13:46:54 changed by anonymous

  • cc set to cwmoad@gmail.com.

07/11/07 13:47:33 changed by cwmoad@gmail.com

  • cc deleted.

07/11/07 16:44:20 changed 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.

07/11/07 16:49:38 changed by BladeHawke

Err.. The above was me

07/12/07 08:40:26 changed by cwmoad@gmail.com

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?

07/12/07 14:25:59 changed 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 :/

07/12/07 14:31:56 changed by cwmoad@gmail.com

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

07/12/07 15:27:41 changed by BladeHawke

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

Index: 0.10/tracauthrequired/authrequired.py
===================================================================
--- 0.10/tracauthrequired/authrequired.py       (revision 2460)
+++ 0.10/tracauthrequired/authrequired.py       (working copy)
@@ -54,6 +54,6 @@
         self.log.debug('Redirecting anonymous request to /login')
         #req.redirect(req.href.login())
         # Testing new redirect syntax.  Thanks to jfernandez@ist.psu.edu
-        req.redirect(self.env.href(req.href.login(), {'referer':req.abs_href(req.path_info)}))
+        req.redirect(req.href.login(), {'referer':req.abs_href(req.path_info)})
         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/)

07/12/07 15:47:34 changed by cwmoad@gmail.com

  • status changed from new to closed.
  • resolution set to fixed.

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

Thanks,

Charlie

07/13/07 00:38:10 changed by BladeHawke

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

09/22/08 05:19:46 changed 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)))

Add/Change #1771 ("The page isn't redirecting properly" Error)




Change Properties
Action