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 is accessed through a normal request.
我有一组专门用于AJAX请求的php页面。我很想知道通过正常请求访问页面时最好的HTTP错误代码是什么。
I have been using 404 at the moment, but the page does exist.
我此刻一直在使用404,但页面确实存在。
I was leaning towards either 403 - Forbidden
or 501 - Not Implemented
.
我倾向于403 - Forbidden或501 - Not Implemented。
3 个解决方案
#1
0
406 Not Acceptable
might be valid in this case.
406 Not Acceptable在这种情况下可能有效。
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.
由请求标识的资源仅能够根据请求中发送的接受报头生成具有不可接受的内容特征的响应实体。
#2
0
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
我不认为状态代码很重要,你可以在所有情况下允许它,但如果你真的不希望普通用户访问它,我会使用409 - 冲突
#3
0
I would use the generic 400 Bad Request status code.
我会使用通用的400 Bad Request状态代码。
#1
0
406 Not Acceptable
might be valid in this case.
406 Not Acceptable在这种情况下可能有效。
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.
由请求标识的资源仅能够根据请求中发送的接受报头生成具有不可接受的内容特征的响应实体。
#2
0
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
我不认为状态代码很重要,你可以在所有情况下允许它,但如果你真的不希望普通用户访问它,我会使用409 - 冲突
#3
0
I would use the generic 400 Bad Request status code.
我会使用通用的400 Bad Request状态代码。