Web 服务器如何知道传入的 HTTP 请求是动态的还是静态的?

How does a web server know the incoming HTTP request is dynamic or static?

抱歉,如果这是一个愚蠢的问题,我是 HTTP 请求的新手。

我从 MDN 那里引用了这句话 - 来源:https://developer.mozilla.org/en-US/docs/Learn/Server-side/First_steps/Client-Server_overview

After the coach submits the form with the team name and number of players, the sequence of operations is:

  1. The web browser creates an HTTP GET request to the server using the base URL for the resource (/best) and encoding the team and player number either as URL parameters (e.g. /best?team=my_team_name&show=11) or as part of the URL pattern (e.g. /best/my_team_name/11/). A GET request is used because the request is only fetching data (not modifying data).
  2. The Web Server detects that the request is "dynamic"

网络服务器如何检测浏览器是动态的?

据我了解,静态网站和动态网站使用完全相同的通信方式 protocol/patterns。 Web 服务器如何检测请求是动态的?

“静态”和“动态”之间的区别不是请求的属性,甚至不是响应的属性,它只是对服务器如何选择生成响应的描述.

在“静态”Web 服务器中,传入的 URL 被映射到本地磁盘上的文件路径,响应是根据该文件的内容创建的。在“动态”Web 服务器中,传入的 URL 以其他方式处理,响应根据更复杂的逻辑生成。有许多不同的方法可以完成,并且中间有许多灰色区域 - URL 可以用一些简单的字符串替换来处理,然后 然后 结果在磁盘上查找,或者“动态”逻辑可以检查一些身份验证信息,然后 return “静态”网络服务器会检查相同的内容,等等

因此服务器不会“检测到请求是动态的”,它会应用一组配置规则,并决定要做什么 - 以文件内容响应,运行 特定程序,return 硬编码错误页面等。将“映射到文件路径并响应该文件的内容”的常见情况称为“静态”只是一种方便 shorthand ,而“运行 特定程序”的另一个极端是“动态”。