开发者

HTTP Status Code for normal request on AJAX pages

开发者 https://www.devze.com 2023-04-11 10:21 出处:网络
I have a set of php pages that I use specifically for AJAX requests. I was wonder what would be the best HTTP error code for when the page 开发者_JAVA百科is accessed through a normal request.

I have a set of php pages that I use specifically for AJAX requests. I was wonder what would be the best HTTP error code for when the page 开发者_JAVA百科is accessed through a normal request.

I have been using 404 at the moment, but the page does exist.

I was leaning towards either 403 - Forbidden or 501 - Not Implemented.


406 Not Acceptable might be valid in this case.

The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.


I don't think status code matter, you can allow it in all cases, but if you really don't want normal users to access it, I'd use 409 - Conflict


I would use the generic 400 Bad Request status code.

0

精彩评论

暂无评论...
验证码 换一张
取 消