Question

NGINX-Tomcat server inside jar file POST method not working in 443 but work in 80

Posted December 8, 2020 289 views
NginxJavaJavaScript

iam using the apache tomcat server web application (JAVA-JSP page) and am using Nginx current version

problem is while using 80 port all the get and post method work but I install letsencrypt SSL certificate using cerbot…am sure all the SSL stuff I have done correctly…

i have JSP file and inside WEB-INF/lib/myfile.jar

on myfile.jar also having JSP page and some lib file like MySQL connector, servlet....etc

when post-action performs its getting like 403 access permission denied but it can work in 80 port

http {
  server {
        server_name server_name.com;
        root /var/lib/tomcat9/webapps/ROOT/;

        index index.jsp;
        location / {
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
            proxy_pass         http://127.0.0.1:8080;
        }
    return 301  https://$host$request_uri;
        }
server {
    server_name demo.mydomain.com;

     listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/demo.mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/demo.mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

      location / {
        #proxy_set_header content-type "application/json";
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
            proxy_pass         http://127.0.0.1:8080;
        }

    }

}

please give me a suggestion is there any other best way to do (sorry for my english)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @azartheencha,

You are using the http port if I’m not mistaken for Apache Tomcat. Can you try and configure Apache Tomcat’s secure port port=“8443” as well. I think that might be one of the reasons.

Can you post your Apache Tomcat’s configuration file as well? I believe the issue would be there rather than in your Nginx configuration file.

Regards,
KFSys