dongzaobei0942 2017-03-17 01:19
浏览 99

如何理解Chrome DevTools中的请求标头?

I've sent a http request with custom headers to a localhost page, and the result is as follow image.

I used php to print out the requests. The printed requests are my custom requests as expect, but the other one in Chrome network tab is different. We can take User-Agent as an example. Why are they different? Which one should I believe?

enter image description here

P.S.

Maybe I cause some misunderstandings.

  1. I use selenium webdriver to control the browser to visit a website
  2. the UA is not from a Nexus, you can consider it as a custom value like "My UA"

The procedure is like [WebDriver] -> [Browser] -> [WebSite].

I guess maybe it is because that the chrome browser shows the default headers, and webdriver post the modified headers to browser to change them, and finally website server received the merged modified headers.

  • 写回答

1条回答 默认 最新

  • dongyutan1703 2017-03-17 02:40
    关注

    The user agent header contains a string describing your browser. Accessing a web page from different browsers will provide different values for the user agent header. According to the right image, you accessed the page from Google Chrome on a Mac - this appears to be true, because you are using the Chrome developer tools. According to the left image, you accessed the page from a Nexus mobile device. If the screenshot on the left is, in fact, from a Nexus mobile, then there is no problem; this is the expected behavior of the user agent header. If the image on the left is from your Chrome browser as well, then I would assume that there is some sort of problem with your custom headers.

    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答