Welcome! Log In Create A New Profile

Advanced

Reverse proxy to Tomcat 8

July 18, 2020 09:20AM
Trying to reverse proxy using Nginx to a tomcat 8 application listening on port 8443 but I'm running into an issue where I'm getting status 404 on all static content.

Below is my config file. The /admin location works with no problems. The /ciphermail is the problematic one. I had the exact same problem with static content with the /admin location until I added the following in my server block:

location ~* \.(jpg|jpeg|png|gif|ico|css|js)$

and then it started working. However, the /ciphermail location seems to still not work.

server {
#LISTEN CONFIG
listen 80 default_server;
listen [::]:80 default_server;
#REDIRECT TO HTTPS UNCOMMENT BELOW TO ENABLE
#return 301 https://$host$request_uri;
keepalive_timeout 70;
#LOGS CONFIG
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
proxy_max_temp_file_size 5120m;
client_max_body_size 5120m;
# Set the .well-known directory alias for initial Lets Encrypt Certificate
location /.well-known {
root /var/www/html/;
}
root /var/www/html;
index index.cfm index.html index.htm;

location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 1y;
}


location /admin {

#Set Real IP Headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

proxy_pass http://localhost:8888/admin/;
}

location /ciphermail {

#Set Real IP Headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;

proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ssl_verify off;

proxy_pass https://localhost:8443/ciphermail/;
}

}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Reverse proxy to Tomcat 8

deeztek July 18, 2020 09:20AM

Re: Reverse proxy to Tomcat 8

Francis Daly July 19, 2020 04:20AM

RE: Reverse proxy to Tomcat 8

deeztek July 19, 2020 07:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 176
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready