java - How to run "Eclipse Che" behind NGINX reverse proxy? -
i have installed on server eclipse che , runs on machine when use locally localhost:8080
i make available internet, behind nginx front reverse proxy. here idea:
example.com/che/ ---> nginx reverse proxy ---> server:8080/
i tried many different nginx configuration... without success. information, eclipse che embeds tomcat instance rewrite rules:
rewriterule ^/api/ext/(.*)$ /ide/ext/$1 [l] rewriterule ^/api/(.*)$ /ide/api/$1 [l] rewriterule ^/$ /dashboard [r]
there 3 webapps deployed on tomcat server:
ide dashboard swagger
if eclipse che behind nginx, above rewrite rules useless , can done directly nginx (that's did)
i have 1 single block in nginx configuration (if possible) here tried far, it's not working , eclipse che not load (my guess websockets not proxified, , miss something) basically, tried "proxypass" different webapps, may not best option.
location /dashboard { proxy_pass http://localhost:8080/dashboard; proxy_redirect off; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } location /ide { proxy_pass http://localhost:8080/ide; proxy_redirect off; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } location /api { rewrite ^/api/ext/(.*)$ /ide/ext/$1 redirect; rewrite ^/api/(.*)$ /ide/api/$1 redirect; }
you can notice added rewrite rules in nginx "api" location rather in tomcat configuration (root webapp) help.
fyi http://nginx.org/ru/docs/http/websocket.html have add websocket connection upgrade specific conf:
map $http_upgrade $connection_upgrade { default upgrade; '' close; } proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection $connection_upgrade;
Comments
Post a Comment