Summary: | Use 301 to redirect from tracklinks.pl | ||
---|---|---|---|
Product: | Koha | Reporter: | Magnus Enger <magnus> |
Component: | OPAC | Assignee: | Magnus Enger <magnus> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | dcook, julian.maurice |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 27009 - Use 301 to redirect from tracklinks.pl
Bug 27009 - Use 301 to redirect from tracklinks.pl |
Description
Magnus Enger
2020-11-13 09:14:30 UTC
Created attachment 113588 [details] [review] 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. Created attachment 113647 [details] [review] 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> 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'. Changing status to Failed QA to get feedback |