You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/10/09 06:44:21 UTC

[GitHub] pdoto edited a comment on issue #3690: URL Prefix Superset Flask

pdoto edited a comment on issue #3690: URL Prefix Superset Flask
URL: https://github.com/apache/incubator-superset/issues/3690#issuecomment-428047547
 
 
   Hi all, i have been working on the same issue for a while and i have some suggestions,
   like @sshcherbakov  mentioned the only way to workaround is to rely on reverse proxy configuration which is not very appropriate, you will end up with a configuration like this:
   ```
   location ~ ^/(users|userstatschartview|roles|permissions|permissionviews|viewmenus|logout|login|logmodelview|dashboardasync|databaseasync|csstemplateasyncmodelview|druid|druidclustermodelview|druiddatasourcemodelview|csstemplatemodelview|csvtodatabaseview|sliceaddview|dashboard|chart|databaseview|tablemodelview|queryview|annotationlayermodelview|annotationmodelview|lang)/ {
       		auth_basic off;
   		rewrite ^/(.*) /MY_PREFIX/$1 permanent;
       		proxy_pass http://MY_ADDRESS:MY_PORT;
       		proxy_set_header Host $host;
   	}
   ```
   as you can see you need to match all the hard codded path that are being redirected to the  default root context ('/'). i will say this is ugly. There might be some further modifications in these paths which make the maintenance not very interesting.
   1- The first solution i'm proposing is to make all the routes uniform by adding **/superset**, then you can rewrite the URL in nginx configuration like this:
   ```
   location ^~ /MY_PREFIX/ {
       		auth_basic off;
       		proxy_pass http://MY_ADDRESS:MY_PORT;
       		proxy_set_header Host $host;
   	}
   		
   	location ^~ /superset/ {
       		auth_basic off;
   		rewrite ^/superset/(.*) /MY_PREFIX/superset/$1 permanent;
       		proxy_pass http://MY_ADDRESS:MY_PORT;
       		proxy_set_header Host $host;
   	}
   ```
   this is working well as long as all the paths start with  **/superset**, but because there are many other paths that does you have to match all of them like mentioned above. Even if it will still be hard coded at least it will make the workaround much easy to maintain and reliable.
   
   2- And the second which might be less easier but good for long term is to define a global parameter configuration in the config file like (**URL_PREFIX**), which should be added as **base path** to all the routes, then get rid of the hard coded URL. 
   But  even if there is still hard codes like redirects make sure to add the base path to it.
   This issue is been open for 2 years now and i really hope it can be fixed.
   Also @joharohl  has done a pretty job with this pull request https://github.com/apache/incubator-superset/pull/1866/files and i think it deserve to be reviewed, applied to all hardcoded, and merge to the master branch.
   
   Thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org