Closed Bug 1234233 Opened 9 years ago Closed 9 years ago

Set APPEND_SLASH to false to prevent use of API URLs that will 301 redirect

Categories

(Tree Management :: Treeherder: API, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

Now that the cause of most/all of the 301 redirects in bug 1230179 have been fixed, I think we should just disable the redirects to prevent people from unknowningly using the "incorrect" URLs that are missing the trailing slash.
Checking the prod web1 gunicorn log: [emorley@treeherder1.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log-20151220 127.0.0.1 - - [18/Dec/2015:11:25:19 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [18/Dec/2015:11:41:35 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [18/Dec/2015:12:00:33 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:44.0) Gecko/20100101 Firefox/44.0" 127.0.0.1 - - [18/Dec/2015:13:21:44 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [18/Dec/2015:14:05:34 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:44.0) Gecko/20100101 Firefox/44.0" 127.0.0.1 - - [18/Dec/2015:14:15:06 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [18/Dec/2015:19:40:40 -0800] "GET /api/project/mozilla-central/resultset/5257 HTTP/1.1" 301 - "-" "SaptarshiGuhaTalos/1.0" 127.0.0.1 - - [18/Dec/2015:19:40:43 -0800] "GET /api/project/mozilla-central/resultset/5275 HTTP/1.1" 301 - "-" "SaptarshiGuhaTalos/1.0" 127.0.0.1 - - [19/Dec/2015:11:56:11 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2595.0 Safari/537.36" 127.0.0.1 - - [19/Dec/2015:19:20:27 -0800] "GET /api/project/mozilla-central/resultset/5277 HTTP/1.1" 301 - "-" "SaptarshiGuhaTalos/1.0" 127.0.0.1 - - [19/Dec/2015:19:20:28 -0800] "GET /api/project/mozilla-central/resultset/5275 HTTP/1.1" 301 - "-" "SaptarshiGuhaTalos/1.0" 127.0.0.1 - - [20/Dec/2015:16:48:31 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [20/Dec/2015:19:12:54 -0800] "GET /api/project/mozilla-central/resultset/5279 HTTP/1.1" 301 - "-" "SaptarshiGuhaTalos/1.0" 127.0.0.1 - - [21/Dec/2015:07:30:46 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0" [emorley@treeherder1.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log [emorley@treeherder1.webapp.scl3 ~]$ The '/api/performance/framework' instances are fixed by bug 1227622 comment 6, the SaptarshiGuhaTalos UA entries have been mentioned in bug 1230179 comment 11. Other than that, looks like we're good to proceed (I've also checked stage, but there's nothing else there).
Attachment #8700648 - Flags: review?(mdoglio)
Attachment #8700648 - Flags: review?(mdoglio) → review+
Checking again for instances that need to be fixed before this lands: Stage... [emorley@treeherder1.stage.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log-20160104 [emorley@treeherder1.stage.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log-20160103 [emorley@treeherder1.stage.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log [emorley@treeherder1.stage.webapp.scl3 ~]$ Prod... [emorley@treeherder1.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log-20151230 127.0.0.1 - - [29/Dec/2015:12:20:01 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Windows NT 10.0; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [31/Dec/2015:04:44:58 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [31/Dec/2015:05:59:38 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0" 127.0.0.1 - - [31/Dec/2015:10:43:13 -0800] "GET /api/performance/framework HTTP/1.1" 301 - "https://treeherder.mozilla.org/perf.html" "Mozilla/5.0 (Android 6.0.1; Mobile; rv:46.0) Gecko/46.0 Firefox/46.0" 127.0.0.1 - - [03/Jan/2016:16:41:58 -0800] "GET /api/optioncollectionhash HTTP/1.1" 301 - "-" "treeherder-pyclient/1.8.0" [emorley@treeherder1.webapp.scl3 ~]$ grep '" 301 ' /var/log/gunicorn/treeherder_access.log [emorley@treeherder1.webapp.scl3 ~]$ /api/performance/framework is fixed on stage (bug 1227622 comment 6), just needs a prod deploy. /api/optioncollectionhash will be fixed by bug 1236894 (I'll then do a python-client release, however it looks like it's rarely used, so depending on future logs we may be able to land this sooner than waiting for everyone to migrate to the newer client),
Depends on: 1236957
Commit pushed to master at https://github.com/mozilla/treeherder https://github.com/mozilla/treeherder/commit/8a83342b7882320beff0bec891bbf7d96d5c2825 Bug 1234233 - Disable APPEND_SLASH to prevent usage of API URLs that 301 Rather than play whac-a-mole as and when people use API URLs that are missing the trailing slash, let's just stop redirecting to make the mistake more obvious: https://docs.djangoproject.com/en/1.8/ref/settings/#append-slash
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: