Search code examples
nginxtcpwebserverprotocols

What protocol does an app server and nginx communicate through?


Background: Imagine you have a web app with this architecture: A Node App Server(Koa) and an Nginx Web Server in front.

Scenario: Client browser makes a request to Server. It gets picked up by nginx and sent through to app server and app server responses back to nginx and nginx response back to client.

Question: From this interaction, What are the protocols at each request and response? Do you configure them, is it http/1 or 1.1 or 2? is it tcp/ip

Browser Request: TCP/IP ??? Nginx Request: ??? App Server Response: ??? Nginx Request: ???


Solution

  • What protocol does an app server and nginx communicate through?

    Whatever protocol you've configured.

    Imagine you have a web app with this architecture: A Node App Server(Koa) and an Nginx Web Server in front.

    Your Koa app is going to use HTTP. Therefore, HTTP is used between Nginx and your app server.

    Browser Request: TCP/IP ???

    HTTP is always ran over TCP. The browser will use whichever version of HTTP is supported by itself and the server.

    Do you configure them, is it http/1 or 1.1 or 2?

    Yes, you configure it. Although, Node.js doesn't support HTTP/1.0 properly. And, HTTP/2 is typically terminated by your web server (Nginx in this example). So, it's typical that HTTP/1.1 is used between Nginx and your Node.js app server. This, obviously, can change if you change it.