I have an IBM WebSphere serving multiple domains:
x.x.x.x:8080/app1
x.x.x.x:9090/app2
...
I need to configure Nginx as reverse proxy to serve:
app1.example.com
app2.example.com
Here is my config but it's not working:
server {
listen 443 ssl;
server_name www.app1.example.com app1.example.com;
ssl on;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
ssl_trusted_certificate example.comCA.crt;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
keepalive_timeout 70;
location / {
access_log app1-access.log;
error_log app1-error.log;
include /etc/nginx/mime.types;
proxy_pass http://x.x.x.x:8080/app1/;
add_header X-Proxy-Cache $upstream_cache_status;
add_header Front-End-Https on;
add_header Cache-Control "public, must-revalidate";
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
With this config I can get the login screen, but I get 404 error after putting credentials.
It doesn't look like you took any steps to fix hosts and ports in Location headers. You probably got a bad redirect resulting in a 404.
Either use proxy_redirect or set the websphere "private headers" like this document describes:
https://developer.ibm.com/wasdev/docs/nginx-websphere-application-server/