Web请求生命周期

时间:2014-08-05 11:04:30

标签: html css html5 request

我今天晚些时候接受采访,我可能会问的一个示例问题如下:

“描述http://mywebsite.com/jobs/edit/1从前端到中间/ API到后端的请求的生命周期。每一步都需要什么样的软件架构?”

我不太确定这一点。有人可以帮助我发布他们认为这样的问题的好答案吗?感谢。

1 个答案:

答案 0 :(得分:1)

我想通过架构,软件就是这个问题。

    1. The IP of mywebsite.com is resolved by a DNS request. 
    2. The DNS request is answered by the DNS server.
    3. A TCP/IP connection is opened to *.*.*.* 
       A http get/post request is issued to the server via HTTP
    4a) A firewall is passed (if present), and the request is hopefully forwarded to the web-server
    4b) The web-server receives the request, 
    and based on it's virtual hosting configuration information and the information in the http-headers, will forward the request to the respective application 
    via FastCGI or using a Server-Module/ISAPI.'
    5. The web-application receives the request for http://mywebsite.com/jobs/edit/1
    6a) HTTP-modules are executed for this request (e.g. forms authentication, banning)
    6b) If the route is registered in the routing regex, the request is routed to the appropriate MVC controller (jobs)
    7. The edit action in the MVC controller is called with parameter 1
    8. The edit view is returned for parameter 1
    9. The client receives the HTML
    10. the port is closed by the client & server

    "Describe the lifecyle of a request to http://mywebsite.com/jobs/edit/1 from front-end to middle/API to backend. 
    What kind of software architecture would be needed at each step?"

    1. Requires DNS-client
    2. Requires DNS-Server
    3. Requires web-browser or TCP/IP/HTTP capable application
    4. Requires web-server that is virtual name based hosting capable
    5. Requires a web-application, like PHP/ASP.NET/Python/Perl
    6-8. Requires MVC application architecture
    9-10. Stateless architecture