为什么 Cassini Web 服务器将我的完全限定域名请求 URL 转换为 IP 地址请求 URL?

发布于 2024-07-17 07:25:54 字数 414 浏览 6 评论 0原文

我有一个网络应用程序,它依赖于浏览器客户端保留 FQDN 才能正常工作,但发生的情况是,在多个浏览器中,我看到 url 被转换为 IP 地址 url(包含正确的 IP 地址),该地址通过来自 Web 服务器的重定向而发生变化。

托管资源的 Web 服务器是 Cassini,HttpRequest 类 Url 属性 返回 URL 中的 IP 地址,而不是 FQDN。

关于如何改变这种行为有什么建议吗?

I have a web application which depends on the browser client retaining the FQDN in order for it to work, but what is happening is that in multiple browsers I am seeing the url get converted into an ip address url (containing the correct IP address) which is getting changed by a redirect from the web server.

The web server hosting the resource is Cassini, and the HttpRequest class Url property is returning the IP address in the URL instead of the FQDN.

Any suggestions on how to change this behavior?

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

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

发布评论

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

评论(3

梦回梦里 2024-07-24 07:25:54

这可能是您的网络服务器配置错误。 例如,在 apache 中,可以使用 ServerName 指令设置在执行某些重写过程时要使用的规范主机名。 一种常见的情况是 Web 服务器在 URL 末尾添加斜杠(“http://example.com/path< /a>" → "http://192.168.1.1/path/")。

我建议看一下curl 的情况。

This is probably a misconfiguration in your web server. In apache (for example), one can set the canonical host name to be used when doing certain rewrite procedures using the ServerName directive. One common one is when the web server adds slash to the end of your URL ("http://example.com/path" → "http://192.168.1.1/path/").

I recommend taking a peek at what's going on with curl.

闻呓 2024-07-24 07:25:54

这不是 DNS 问题,而是 Web 服务器配置问题。

是的,DNS 用于将 URL 的主机名部分转换为 IP 地址。

但是,该 IP 地址永远不会出现在浏览器栏中,除非 Web 服务器通过发送重定向来告诉它

This is not a DNS issue, it's a web server configuration issue.

Yes, the DNS is used to convert the hostname part of the URL into an IP address.

However that IP address will never appear in the browser bar unless the web server tells it to by sending a redirect.

一刻暧昧 2024-07-24 07:25:54

感谢所提供的有用信息,我能够将此问题追溯到 HttpWorkerRequest .NET Framework 的抽象类,作为 Cassini 实现的一部分。 Cassini 实现无法覆盖 GetServerName,并且基本实现返回的是 IP 地址而不是域名。

Thanks to the helpful information provided, I was able to track down this issue to an incomplete implementation of the HttpWorkerRequest abstract class of the .NET Framework as part of the Cassini implementation. The Cassini implementation failed to override the GetServerName and the base implementation was returning the IP address instead of the domain name.

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