-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable basepath/url for nginx reverse proxing on diff location other than /? #985
Comments
Google suggests this http://flask.pocoo.org/snippets/35/ . Feel free to open a pull request if it works for you. |
It did work, but then I ran into countless absolute links that I haven't found a way to put them behind a prefix. Any ideas? |
@michailsal does url_for work correctly? If so it is just matter or using it thoroughly. |
url_for does work for the most part, but still there are many hardcoded absolute links e.g.
Shall I just fix them by adding url_for (which I have already done locally) and open a pull request? |
@michailsal yes, please! |
Is there any news regarding these changes / pull request ? The same issue applies on wsgi serving with Apache for example: but immediately I get a 404 with http://myhost/caravel/welcome without preserving the baseurl like |
I haven't had time to work on this, I do know though that even if somehow you manage to preserve the baseurl and not being redirected, there are still many absolute links pointing to "/" instead of using "url_for" |
Somewhat related to this, I did a brute force thing with apache to get it (almost) working:
This almost works, but then I run into issues with JavaScript, because it does things like for example in welcome.js: // Builds a dataTable from a flask appbuilder api endpoint
let url = '/' + modelView.toLowerCase() + '/api/read'; I don't see a good way of fixing that, without touching caravel source code in quite a few places. I am considering to introduce another sub-domain to be able to proxy my backend caravel app without the need to use paths. I was just trying to avoid it because another sub-domain means I need to separately configure it with our single-sing-on. |
Is anyone working this? I just tried to put Gunicorn (serving Superset) behind an nginx proxy. Some links work, but others didn't. This is relevant part from my nginx config file:
In Superset, I tried with and without ENABLE_PROXY_FIX (not sure what this setting does?). |
I have made a proof of concept that works behind a proxy. The python code changes were fairly straightforward by switching hard coded urls for Flasks' The JS though... I just did the hacky thing by templating I would love to contribute this back, but need some guidance on how to approach the JS side of things. |
@joharohl if we have the code i'd say to just open a PR for the python code and we can discuss about the js. We can update the PR later or just open a new one. |
related #3690 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue |
so what is the purpose for WEBDRIVER_BASEURL in config? |
I found it very frustrating to setup a base url for superset. If you want to save some time, I condensed a couple of comments into a working example here: https://github.com/komoot/superset-reverse-nginx-example |
@christophlingg So how to implement your working example in latest apache superset on |
@syazwan0913 I dont know if there are already docker images for the current master. you can try put see also https://github.com/amancevice/docker-superset#versions |
@christophlingg Right now I am using the code from here https://github.com/apache/incubator-superset When I used your |
@christophlingg the static files showed already but another problem came up. When I run |
@christophlingg problem solved already. thanks |
@christophlingg Not all links will be added the prefix right? |
I have run according to your configuration, but I am still reporting errors The mistakes are as follows: Looking forward to your help. |
@axuew you are right, we need more rewrites, I updated the repository: komoot/superset-reverse-nginx-example@718bb2e I went down all this path and came to a situation where it worked. Nevertheless it is a dirty and I am now going for solution without base path. |
@christophlingg Why need to add |
The configuration works according to your method, but there is one fatal error |
With a this new commit it should work as expected: komoot/superset-reverse-nginx-example@e18421e |
@christophlingg Error 503 |
Landed here while trying to configure k8s ingress path based routing to superset. The nginx solution did no work for me, superset does not consider
So any of these paths will not hit the correct ingress. According to this PR comment #1866 (comment), the only solution for now is to use subdomain based routing. |
The very fact that htmls are templated by Python is a bad architecture, and needs to be changed. Which is likely to not happen any time soon. Right now there are like 5 different approaches to forming urls, and most of them I consider as a classic hardcode, and hard to fix even if you didn't want to be able to upgrade anymore. |
Anyone able to configure the url using latest Superset? |
I created a script that adds prefix to hardcoded URLs in python and js code in Superset image and added middleware and nginx. But it is a very hacky way. |
Just landed on this having been looking for a way to configure a base url path. Like others, I was hoping to find an easy and supported way of configuring the superset base url. With docker-compose being the first documented way to launch superset, I'd have thought there would be good options! I tend to proxy my containers through traefik, using a I checked out the superset-reverse-nginx-example, in traefik that would be a lot of From the above comments, it looks like the js is currently limiting a configurable base url, in that the js hosts most of the hard-coded URLs. Is this still the case? Does anyone know if there is a way to rebuild the repo from typescript with a configurable base url? e.g. PR #15105 |
@alexleach There are just too many urls to track down and convert, on both the python and js/ts side. The best option right now would be an nginx rewrite based on a regex, as @acristu mentioned but it is very hacky and likely to break anytime superset adds a new route. |
@nytai Thanks for the quick reply! Yes the codebase is pretty huge, and tracking it all down looks like it would be a mission. I'd personally not have a clue where to begin, so will have to go the subdomain route and get a dedicated SSL certificate for it, which isn't ideal, but as you say there are too many possible places to track down and convert, and I wouldn't have a clue what to do even if I found one! Thanks |
Six years passed, but this issue is still. motherfucker! |
mind you language @zhangzhenhu |
Is there any way to configure caravel to accept requests under /my-whatever-path/.....? I would like to reverse proxy caravel using nginx but not on / location block.
The text was updated successfully, but these errors were encountered: