3

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.

rvs
  • 4,027
  • 1
  • 25
  • 30
Amir
  • 31
  • 3
  • 1
    "Not working" - more information needed. What works, what doesn't work, show logs. Turn off all your security features and HTTPS until you get the basics working. – Tim Apr 11 '16 at 21:42

1 Answers1

0

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/

>             proxy_set_header "$WSSC" $scheme;
>             proxy_set_header "$WSPR" $server_protocol;
>             proxy_set_header "$WSRA" $remote_addr;
>             proxy_set_header "$WSRH" $host;
>             proxy_set_header "$WSRU" $remote_user";
>             proxy_set_header "$WSSN" $server_name;
>             proxy_set_header "$WSSP" $server_port;
>             proxy_set_header "$WSIS" $is_ssl;
> 
>             # Note that these vars are only available if
>             # NGINX was built with SSL
>             proxy_set_header "$WSCC" $ssl_client_cert;
>             proxy_set_header "$WSCS" $ssl_cipher;
>             proxy_set_header "$WSSI" $ssl_session_id;
covener
  • 1,665
  • 9
  • 15