如何重定向到网络服务器的0.0.0.0
我正在运行一个 Rails 应用程序,它将传入请求重定向到 0.0.0.0:3000
在我的本地计算机上,它可以工作,因为我在 0.0.0.0:3000 上运行我的 mongrel 服务器,但是当我向远程服务器发出 HTTP 请求时,它可以工作将我重定向到我的工作站的 0.0.0.0:3000 但我希望它将请求重定向到它自己的 0.0.0.0:3000
我在 ubuntu 10.04 上使用 mongrel 1.2.0.pre2 作为网络服务器
I'm running a rails application which redirects the incoming requests to 0.0.0.0:3000
On my local machine it works since I'm running my mongrel server on 0.0.0.0:3000 but when I make an HTTP request to my remote server it redicts me to my workstation's 0.0.0.0:3000 but I want it to redict the request to its own 0.0.0.0:3000
I'm using mongrel 1.2.0.pre2 as webserver on ubuntu 10.04
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
地址 0.0.0.0 将始终映射到 127.0.0.1 (localhost),但它与 localhost 不同之处在于,当绑定到 localhost 时,它会监听所有接口,因此可以使用以下命令从任何计算机访问 Web 服务器它的主机名/IP 地址。如果 Web 服务器侦听本地主机,则只能从同一台计算机访问它。
因此,在应用程序中重定向到 0.0.0.0 实际上没有任何意义,因为您是在客户端而不是服务器的上下文中进行重定向。
(要找到满足您期望的解决方案,您需要告诉我们您实际上想通过这样做来完成什么)
The address 0.0.0.0 will always map to 127.0.0.1 (localhost), but it differs from localhost in that, when it is bound to, it is listening on all interfaces, and thus the web server can be accessed from any machine by using its hostname/IP address. If the web server listens on localhost it can only be accessed from the same machine.
Redirecting to 0.0.0.0 in your application, thus, doesn't really make any sense, because you're redirecting in the context of the client, not the server.
(To find a solution that does what you expect, you'd need to tell us what you're actually trying to accomplish by doing this)
据我所知,0.0.0.0 是一个不可路由的 IP,主机在尚未分配地址时声称它是自己的 IP。网络服务器与该地址无关。
As I know 0.0.0.0 is a non-routable ip that a host claims as its own when it has not yet been assigned an address. Webserver has nothing to do with this address.