网站返回 302 而不是 200

发布于 2024-09-13 03:59:27 字数 332 浏览 2 评论 0原文

好吧,这个让我吓坏了。 我使用了 Http 标头检查工具来检查我的网页的标头,猜猜看是什么。 在每个请求中,响应都是 302 而不是 200。

domain.con
www.domain.con
http://www.domain.con

那么,我在这里遗漏了什么吗? 我没有以任何方式放置任何重定向。

那么 f#$% 我的网站重定向到哪里?是否存在安全漏洞?

更新:谷歌搜索时发现这个

Well this one freaks me out.
I used a Http Header check tool to check the headers of my webpage and guess what.
In every request the response was 302 instead of 200.

domain.con
www.domain.con
http://www.domain.con

So, am i missing something here?
I have not placed any redirect in any way.

So where the f#$% my website redirects? Is there a security hole?

UPDATE: While googling found this one

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

陌生 2024-09-20 03:59:27

domain.comwww.domain.com 不同 - 这是一个重定向。

domain.com is not the same as www.domain.com - that's a redirect.

君勿笑 2024-09-20 03:59:27

你得到这个是因为.net/IIS将你的www.domain.com或domain.com重定向到www.domain.com/default.aspx,所以你得到一个302的标头,然后一个200的标头。我认为这是设计使然但很混乱。

You are getting this because .net/IIS redirects your www.domain.com or domain.com to www.domain.com/default.aspx, so you get a header with 302 and then one for 200. I think this is by design but very confusing.

梦忆晨望 2024-09-20 03:59:27

也许是这样的一个例子:

302 Found

这是最流行的重定向代码,但也是与标准相矛盾的工业实践的一个例子。 HTTP/1.0 规范 (RFC 1945) 要求客户端执行临时重定向(最初的描述短语是“暂时移动”),但流行的浏览器使用 303 See Other 的功能实现了 302。因此,HTTP/1.1添加了状态码303和307来区分这两种行为。然而,大多数 Web 应用程序和框架仍然使用 302 状态代码,就好像它是 303 一样。

303 查看其他(自 HTTP/1.1 起)

可以使用 GET 方法在另一个 URI 下找到对请求的响应。当收到对 PUT 的响应时,应假定服务器已收到数据,并且应使用单独的 GET 消息发出重定向。

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Maybe a case of this:

302 Found

This is the most popular redirect code, but also an example of industrial practice contradicting the standard. HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302 with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviours. However, the majority of Web applications and frameworks still use the 302 status code as if it were the 303.

303 See Other (since HTTP/1.1)

The response to the request can be found under another URI using a GET method. When received in response to a PUT, it should be assumed that the server has received the data and the redirect should be issued with a separate GET message.

http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

烟雨凡馨 2024-09-20 03:59:27

您可能忘记在网址末尾添加最后一个斜杠。大多数网络服务器会将您重定向到包含斜杠的“规范”位置。如果包含斜杠,您可能会得到您正在寻找的响应。

It's possible that you forgot to add a final slash to the end of your URL. Most webservers will redirect you to the "canonical" location that includes the slash. If you include the slash, you may get the response you're looking for.

甩你一脸翔 2024-09-20 03:59:27

您使用表单身份验证吗?登录页面是默认页面(例如 auth.aspx)之外的其他页面吗?如果是这种情况,那么您总是会收到 302 代码,并且页面将重定向到登录页面。

Are you using forms authentication? and log in page is some other page than the default page say auth.aspx? If this is the case then you will allways get 302 code and the page will be redirected to login page.

苍风燃霜 2024-09-20 03:59:27

在 ASP.Net 中,我们可以使用 Response.Redirect & 进行重定向。服务器.传输.
如果我们使用 server.Transfer,状态代码 302 将永远不会命中 &直接冲到200了。
如果我们使用 Response.Redirect ,它会从 302 传递到 200 作为响应。这只不过是往返。

In ASP.Net we can redirect by using Response.Redirect & Server.Transfer.
If we go with server.Transfer the status code 302 will never hit & directly hits the 200.
If we go with Response.Redirect it passes from 302 to 200 as response.. Which is nothing but roundtrip.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文