[Bug 27009] New: Use 301 to redirect from tracklinks.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 Bug ID: 27009 Summary: Use 301 to redirect from tracklinks.pl Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org In opac/tracklinks.pl we use a simple redirect to send the user on to the actual URL, after tracking: print $cgi->redirect($uri); This sends a "302 Moved Temporarily" to the browser as a default. One of our clients had some SEO work done on their websites, and one of the recommendations was to use "301 Moved Permanently" instead. This makes some sense, the URLs we redirect to do not change very often, I guess. According to https://metacpan.org/pod/CGI#Generating-a-redirection-header, the solution is to change the call to redirect() thusly: print $q->redirect( -uri => $uri, -status => '301 Moved Permanently' ); Patch coming. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- Created attachment 113588 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=113588&action=edit Bug 27009 - Use 301 to redirect from tracklinks.pl The default for the tracklinks.pl redirect is "302 Moved Temporarily". It makes more sense to use "301 Moved Permanently". To test: 1. Set TrackClicks = Track 2. Make sure you have a MARC record with an external link in 856$u 3. In the OPAC, click on the link and use e.g. Developer tools to check on the HTTP status code sent by tracklinks.pl. It will be 302. 4. Apply this patch and restart all the things 5. Click on the external link in the OPAC again. The status code should now be 301. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #113588|0 |1 is obsolete| | --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 113647 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=113647&action=edit Bug 27009 - Use 301 to redirect from tracklinks.pl The default for the tracklinks.pl redirect is "302 Moved Temporarily". It makes more sense to use "301 Moved Permanently". To test: 1. Set TrackClicks = Track 2. Make sure you have a MARC record with an external link in 856$u 3. In the OPAC, click on the link and use e.g. Developer tools to check on the HTTP status code sent by tracklinks.pl. It will be 302. 4. Apply this patch and restart all the things 5. Click on the external link in the OPAC again. The status code should now be 301. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- HTTP 301 responses are cacheable by default, which means some browsers can cache the redirect indefinitely, and can redirect without doing the request to tracklinks.pl once it is cached. I believe it is not the intended behaviour for a script that is supposed to track redirects. I don't know what are the modern browsers caching strategies for those redirects, but just to be sure, I think we should add a header 'Cache-Control: no-store'. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #4 from Julian Maurice <julian.maurice@biblibre.com> --- Changing status to Failed QA to get feedback -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |magnus@libriotech.no -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27009 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org