Django:不存在的URL的奇怪HTTP状态代码

时间:2016-09-02 09:23:00

标签: django django-middleware

我有一个带有激活翻译的Django网站(django.middleware.locale.LocaleMiddleware),

我有人要求不存在的页面:

  

https://example.com/nonexisting

然后Django回复:

HTTP/1.1 302 FOUND
Date: Fri, 02 Sep 2016 09:15:45 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Cookie,Host
Location: https://example.com/de/nonexisting
Content-Type: text/html; charset=utf-8

HTTP/1.1 301 MOVED PERMANENTLY
Date: Fri, 02 Sep 2016 09:15:45 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Cookie,Host
X-Frame-Options: SAMEORIGIN
Content-Language: de
Set-Cookie: django_language=de; expires=Sat, 02-Sep-2017 09:15:45 GMT; Max-Age=31536000; Path=/
Location: https://example.com/de/nonexisting/
Content-Type: text/html; charset=utf-8

HTTP/1.1 404 NOT FOUND
Date: Fri, 02 Sep 2016 09:15:45 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Cookie,Host
X-Frame-Options: SAMEORIGIN
Content-Language: de
Set-Cookie: django_language=de; expires=Sat, 02-Sep-2017 09:15:45 GMT; Max-Age=31536000; Path=/
Content-Type: text/html; charset=utf-8

用户按此顺序收到: 302301404

如何实现用户直接获取404?

0 个答案:

没有答案