I've got 2 VM :
VM1 is front with urlvm1.site url and is accessible by users
VM1 has spring security & spring gateway
VM2 is back and is not directly accessible by users. it has urlvm2.site url.
VM2 has nginx and superset, which we're trying to serve to users.
Superset doesn't allow url prefix so I made one using recommandations on ngnix :
upstream superset-server {
server urlvm2.site:8088;
}
server {
listen 443 ssl default_server;
server_name urlvm2;
ssl on;
ssl_certificate /etc/nginx/certs/urlvm2.pem;
ssl_certificate_key /etc/nginx/certs/urlvm2.key;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA;
location ^~ /awesome/ {
rewrite ^/awesome/(.*)$ /$1?$args break;
proxy_pass http://superset-server;
sub_filter_types *;
sub_filter_once off;
sub_filter '/api/v1/' '/awesome/api/v1/';
sub_filter 'api/v1/' 'awesome/api/v1/';
sub_filter '/dashboard/' '/awesome/dashboard/';
sub_filter '/chart/' '/awesome/chart/';
sub_filter '/superset/' '/awesome/superset/';
sub_filter '/tabstateview/' '/awesome/tabstateview/';
sub_filter '/savedqueryview/' '/awesome/savedqueryview/';
sub_filter '/databaseview/' '/awesome/databaseview/';
sub_filter '/tablemodelview/' '/awesome/tablemodelview/';
sub_filter '/static/assets/' '/awesome/static/assets/';
sub_filter '/static/appbuilder/' '/awesome/static/appbuilder/';
sub_filter '/users/' '/awesome/users/';
sub_filter '/roles/' '/awesome/roles/';
sub_filter '/rowlevelsecurityfiltersmodelview/' '/awesome/rowlevelsecurityfiltersmodelview/';
sub_filter '/logmodelview/' '/awesome/logmodelview/';
sub_filter '/annotationlayermodelview/' '/awesome/annotationlayermodelview/';
sub_filter '/csstemplatemodelview/' '/awesome/csstemplatemodelview/';
sub_filter '/csstemplateasyncmodelview/' '/awesome/csstemplateasyncmodelview/';
sub_filter '/logout/' '/awesome/logout/';
sub_filter '/explore/' '/awesome/explore/';
sub_filter '/tableschemaview/' '/awesome/tableschemaview/';
sub_filter 'href="/back"' 'href="/awesome/back"'; # no tailing slash
proxy_redirect 'http://$host/' '/awesome/';
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
So when i call https://urlvm2.site/awesome : it just works.
Now the urlvm2 is normally accessible only by VM1, which is urlvm1.site and has spring gateway with this route :
- id: routing superset
uri: https://urlvm2.site/awesome
predicates:
- Path=/awesome/**
Now the problem :
When I hit https://urlvm1.site/awesome, i get redirected/302 to Location: https://urlvm2.site/awesome/superset/welcome/ instead of https://urlvm2.site/awesome/superset/welcome/ and all my links are linked to urlvm2.site instead of urlvm1.site.
The 302 is served by Superset, and in no way due to spring gateway (same conf on a jenkins on another VM gets me a 200)
I'm no nginx expert, sadly, and looking for an explaination on how to have my rewriting not rewriting the root of the url.
I tried changing host variable to urlvm1.site, but to no success.
Thanks in advance for your expertise !