400 The Plain Http Request Was Sent To Https Port

This article delves into the world of HTTP requests and their authentication mechanisms, with a specific focus on Nginx. Understanding how to set up HTTPS connections using HTTP/2 and TLS is crucial in today's cybersecurity landscape.

HTTP/1.1 is an older protocol that used TCP for all communication between the client and server. However, this can lead to performance issues when using HTTP/2 with modern browsers. To resolve this issue, it's essential to enable HTTPS connections using HTTP/2.

Nginx as a Reverse Proxy

nginx is an open-source web server and HTTP/1.1 proxy server that can be used as a reverse proxy in front of other servers or applications. To set up HTTPS connections using HTTP/2 with Nginx, you need to use the following configuration:

<http server
        <server_name example.com>
        <http11_lv2 enable
        </http11_lv2>
        <http11_lv3 keepalive active
        </http11_lv3>
        <ssl_certificate /path/to/ssl/certificates.crt
        <ssl_key_file /path/to/ssl/keyfiles/server.key
        ></server_name>

        <http server
            <server_name example.net>
            <http11_lv2 enable
            </http11_lv2>
            <http11_lv3 keepalive active
            </http11_lv3>
            <ssl_certificate /path/to/ssl/certificates.crt
            <ssl_key_file /path/to/ssl/keyfiles/client.key
            ></server_name>

        </http server>

In this configuration, we're enabling HTTP/2 for both servers (example.com and example.net), keeping the connection alive with keepalive enabled, and specifying the SSL certificates and keys.

https://conferences.law.stanford.edu/ipsummerschool2022/2014/01/21/et-auctor-tortor-nunc-2