Opened 7 years ago

Closed 6 years ago

#9397 closed (invalid)

weird HttpResponseRedirect reaction to url

Reported by: billychasen Owned by: nobody
Component: HTTP handling Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by mtredinnick)

If I have a url defined, such as:

(r'^hello$', 'mysite.index.views.hello')

and let's say I have a page on http://mysite.net that redirects via HttpResponseRedirect(reverse('mysite.index.views.hello'))

If I am at http://www.mysite.net -- it correctly goes to http://www.mysites.net/hello

If I am at http://mysite.net (no www) -- it redirects to http://mysite.net/.net/hello

It's easily fixed by changing the url definition to

(r'^hello/$', 'mysite.index.views.hello')

(adding a trailing forward slash)

Seems to me though, that this shouldn't be required (seems a little buggy and took awhile to track down)

Change History (4)

comment:1 Changed 7 years ago by billychasen

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I mistyped on the regex -- please ignore the $ (dollar sign) on the end

comment:2 Changed 7 years ago by SmileyChris

  • Component changed from Uncategorized to HTTP handling

A slash shouldn't be required.

But we'll need some more information to track the problem down - in fact, it sounds like it could be a web server mis-configuration rather than something which is happening in Django. If you run the local web server on your server (manage.py runserver 0:8000), what happens when you go to http://mysite.net:8000 ?

comment:3 Changed 7 years ago by mtredinnick

  • Description modified (diff)

(Fixed description formatting to stop my eyes watering.)

comment:4 Changed 6 years ago by SmileyChris

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

3 months with no response from the reporter. Closing - but if anyone has the same problem, feel free to reopen.

Note: See TracTickets for help on using tickets.
Back to Top