Nginx as ssl reverse proxy for wildfly

nginxreverse-proxyssl

I am trying to setup nginx to be reverse proxy for wildfly 8.0.0.Final.

Part of my configuration file for HTTPS redirect:

location /console {
  include          conf.d/proxy.conf;
  proxy_pass       http://127.0.0.1:9990/console;
  proxy_redirect   http://127.0.0.1:9990/console  https://X.Y.W.Z/console;
}
 ... similar location for...
/management
/logout
/error
... 

location / {
  include          conf.d/proxy.conf;
  proxy_pass       http://127.0.0.1:8080/;
}

proxy.conf:

proxy_set_header        Host            $host;
proxy_set_header        X-Forwarded-Proto $scheme;
add_header              Front-End-Https   on;

Problem is – when I login to /console I get error message:

Access Denied:
Insufficient privileges to access this interface.

I don't even have idea what is causing this. Any help is appreciated!

Best Answer

Marko, maybe too late, but I was able to get nginx and wildfly working following your configuration, let me share that:

In proxy_headers.conf:

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
add_header Front-End-Https on;

In my app.conf

location / {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:8080;
}

location /management {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/management;
}

location /console {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/console;
}

location /logout {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990/logout;
}

location /error {
   include conf.d/proxy_headers.conf;
   proxy_pass http://127.0.0.1:9990;
}

Before I did this I faced the same error as you so using developer tools in Chrome I figured out that ajax requests to /management and the others paths are done so I took care of them.