OiO.lk Blog java Assistance with NGINX Reverse Proxy for Java Applications on EC2 with CSF
java

Assistance with NGINX Reverse Proxy for Java Applications on EC2 with CSF


I am seeking assistance with configuring NGINX as a reverse proxy for a Java application running on a Jetty server. Here’s the current setup:

I am running multiple Java servers on an EC2 instance, each on its own port.
CSF is being used to redirect connections from port 443 on the public IP of server X to the local IP and respective ports.
I would like to use NGINX as a reverse proxy to handle all connections through a single public IP, and route them based on the subdomain to the appropriate Java server.
For example, when customers login via javax.mydomain.com, NGINX should redirect the request to the appropriate local Java server running on a specific port.

Here is the configuration I have tried in NGINX:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name acttest.mydomain.com;

    ssl_certificate /etc/ssl/certs/certificate.crt;
    ssl_certificate_key /etc/ssl/certs/server.key;

    ssl_protocols TLSv1.2 TLSv1.3;  # Ensuring supported protocols are used
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass https://acttest.mydomain.com:4450;
        include proxy_params;
    }
}

However, when attempting to log into the system, I receive the following error:

"This site can’t provide a secure connection acttest.mydomain.com sent an invalid response. ERR_SSL_PROTOCOL_ERROR."

It seems that NGINX is forwarding the connection to the Java application, but after entering a username and password, this error appears.

Would you be able to provide some insight into what might be causing this issue? Specifically, I would like to ensure that NGINX correctly handles the SSL termination and forwards the connection properly to the internal Java servers.



You need to sign in to view this answers

Exit mobile version