Page MenuHomePhabricator

Invalid action page should probably not have HTTP status 200
Open, LowPublic

Description

Author: standsthechurchclock+bugzilla

Description:
Calling index.php with an invalid action, such as this:

http://en.wikipedia.org/w/index.php?title=Main_Page&action=invalidaction

should probably return an HTTP status code which indicates an error, such as 400, rather than success:

HTTP/1.0 200 OK

Version: 1.21.x
Severity: normal

Details

Reference
bz24144

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:05 PM
bzimport set Reference to bz24144.
bzimport added a subscriber: Unknown Object (MLST).

Yes indeed. Any suggestion for a HTTP status code ?

400 Bad Request seems appropriate. Probably won't be done in time for tarball, though.

Nuria added a subscriber: Nuria.Sep 23 2016, 7:42 PM

Any traction here?

See also this ticket https://phabricator.wikimedia.org/T145922 and how pages like:

"https://en.wikipedia.org/w/index.php?title=User%20:GoogleAnalitycsRoman6/google-api&action=history"

are being reported as true pageviews to wikipedia. Pages like this one are used by bots continuously as some kind of (just guessing) of keepalive.

Well, action=history is a valid action, just for https://en.wikipedia.org/w/index.php?title=User%20:GoogleAnalitycsRoman6/google-api&action=history%22 it's not an actual page. In that case I think a 404 would be most appropriate, since the requested action can't be taken on the requested page as the page does not exist.

Huji added a comment.Sep 23 2016, 8:22 PM

I think 404 is the correct answer for that other issue.

Here, I think 400 is probably the best answer; but 404 can also be suitable (the action page is "nonexistent" so 404).

Agree that 200 (and, consequently, recording the request as a pageview, which causes notable distortions to our readership stats) is not appropriate in this case. 400 sounds like a plausible choice.