博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何用ip访问web服务器_Web服务器如何知道您是否正在使用直接IP地址访问?
阅读量:2517 次
发布时间:2019-05-11

本文共 2738 字,大约阅读时间需要 9 分钟。

如何用ip访问web服务器

如何用ip访问web服务器

how-do-web-servers-know-if-you-are-using-direct-ip-address-access-or-not-00

Usually, we just type in the address of a website we want to view, but would a web server actually “know” if we used the direct IP address instead? Today’s SuperUser Q&A post has the answer to a confused reader’s question.

通常,我们只键入要查看的网站的地址,但是Web服务器实际上会“知道”是否使用直接IP地址吗? 今天的“超级用户问答”帖子回答了一个困惑的读者的问题。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“问答”环节由SuperUser提供,它是Stack Exchange的一个分支,该社区是由社区驱动的Q&A网站分组。

Photo courtesy of .

图片由 。

问题 (The Question)

SuperUser reader Joseph A. wants to know how web servers can tell if you are using direct IP address access or not:

超级用户读者Joseph A.想知道Web服务器如何判断您是否正在使用直接IP地址访问:

Some web servers, when accessed using their IP address, return an error that direct IP address access is not allowed. I have been wondering for some time how this works.

某些Web服务器在使用其IP地址进行访问时,返回错误,指示不允许直接IP地址访问。 我一直想知道它是如何工作的。

Does a browser always resolve the IP address and connect to it? Direct IP address access is just skipping DNS altogether, right? How does a remote server even know that you skipped DNS?

浏览器是否总是解析IP地址并连接到它? 直接IP地址访问只是完全跳过DNS,对吗? 远程服务器甚至如何知道您跳过了DNS?

How do web servers know if you are using direct IP address access or not?

Web服务器如何知道您是否正在使用直接IP地址访问?

答案 (The Answer)

SuperUser contributor iAdjunct has the answer for us:

超级用户贡献者iAdjunct为我们提供了答案:

To answer your question of how it knows, it has to do with what your browser sends the web server. You are right that the system always resolves it to an IP address, but the browser sends the URL you attempted to access in the HTTP header.

要回答有关它的信息的问题,它与浏览器发送Web服务器的内容有关。 没错,系统总是将其解析为IP地址,但浏览器会在HTTP标头中发送您尝试访问的URL。

Here is a sample header that I found online, modified to look as though you used Firefox on Windows and typed apple.com into the address bar:

这是我在网上找到的示例标头,经过修改后看起来就像您在Windows上使用Firefox,并在地址栏中输入apple.com一样:

how-do-web-servers-know-if-you-are-using-direct-ip-address-access-or-not-01

Here is what the header would look like if you used its IP address:

如果您使用IP地址,则标题如下所示:

how-do-web-servers-know-if-you-are-using-direct-ip-address-access-or-not-02

Both of these would be sent to the same IP address over a socket, but the browser tells the web server what it accessed. Why? Because web servers with the same IP address may host multiple websites and give different pages for each. It cannot distinguish who wants which page by IP address because they all have the same one, but it can distinguish them by the HTTP header.

两者都将通过套接字发送到相同的IP地址,但是浏览器告诉Web服务器它访问了什么。 为什么? 因为具有相同IP地址的Web服务器可能托管多个网站,并为每个网站提供不同的页面。 它不能通过IP地址来区分谁想要哪个页面,因为它们都具有相同的页面,但是可以通过HTTP标头来区分它们。



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? .

有什么补充说明吗? 在评论中听起来不错。 是否想从其他精通Stack Exchange的用户那里获得更多答案? 。

翻译自:

如何用ip访问web服务器

转载地址:http://vdfwd.baihongyu.com/

你可能感兴趣的文章
redux、immutablejs和mobx性能对比(三)
查看>>
jQuery实现简单而且很酷的返回顶部链接效果
查看>>
mac 终端 常用命令
查看>>
EGL接口介绍-----Android OpenGL ES底层开发
查看>>
电梯调度程序的UI设计
查看>>
转自 zera php中extends和implements的区别
查看>>
Array.of使用实例
查看>>
【Luogu】P2498拯救小云公主(spfa)
查看>>
如何获取网站icon
查看>>
几种排序写法
查看>>
java 多线程的应用场景
查看>>
dell support
查看>>
转:Maven项目编译后classes文件中没有dao的xml文件以及没有resources中的配置文件的问题解决...
查看>>
解决“Eclipse中启动Tomcat后,http://localhost:8080/无法访问”的问题
查看>>
LeetCode Online Judge 题目C# 练习 - Longest Valid Parentheses
查看>>
百度杯WriteUp
查看>>
test
查看>>
系统日志2-日志查询
查看>>
作用域和 DOM
查看>>
P1280 尼克的任务
查看>>