Opened 17 years ago
Closed 17 years ago
#4685 closed (fixed)
"View on site" links in admin don't work for an https site
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | treborhudson@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This was mentioned as a side-note in http://code.djangoproject.org/ticket/634.
My site is entirely served through https.
When I added get_absolute_url() methods to my models, the "view on site" links appeared in the admin, as expected. Although they initially go to an https location (with "r" and some numbers), that then redirects to an http link, which doesn't work. If it used "https:" instead of "http:", it would work.
The problem seems to be the hard-coded "http" at line 64 of django/views/defaults.py :
return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
I don't know how to figure out whether "http" or "https" is appropriate, or I'd submit a patch...
Attachments (2)
Change History (6)
by , 17 years ago
Attachment: | check_protocol.diff added |
---|
comment:1 by , 17 years ago
Cc: | added |
---|---|
Has patch: | set |
Needs tests: | set |
I just happened to see the same check in sitemaps so I made a patch. I don't have an easy way to test this so I'm hoping cbrand can test. I'm adding myself to the CC list to be notified. Thanks.
comment:2 by , 17 years ago
I applied that patch to my (0.96) tree and it fixes the problem.
Thanks !
comment:3 by , 17 years ago
Needs tests: | unset |
---|
I tested in a non-https site and it didn't break anything. I'm going to unflag "needs tests".
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch attempt, needs testing