/shortner API does not take into account when Superset is behind a reverse proxy to be served over HTTPS
When Superset is served over HTTPS by a reverse proxy (nginx/Apache), the generated URL has "http" as scheme instead of "https".
The URL scheme is generated from the value of request.scheme, but it should take into account also headers like X-Forwarded-Proto and, in general, X-Forwarded-* headers (e.g for host).
https://github.com/apache/incubator-superset/blob/20e68c87402414fabb3e0fd715be487fa7ebf5cc/superset/views/core.py#L670
Expected results
The URL starts with "https://"
Actual results
The URL starts with "http://"
Screenshots
How to reproduce the bug
- Put nginx or Apache in front of Superset to serve it over HTTPS (Superset has config "ENABLE_PROXY_FIX = True" and the server adds the header X-Forwarded-Proto and sets it to "https")
- Go to a dashboard
- Click on the arrow on the right, then click to "Share dashboard"
- See error
Environment
- superset version: 0.34.0
- python version: 3.6.9
Checklist
- [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ ] I have reproduced the issue with at least the latest released version of superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
HTTPS works as expected on all others urls without problems, the reverse proxy redirects all the requests from http to https.
Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.83. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Strange, this should work correctly since we are setting: PROXY_FIX_CONFIG = {"x_for": 1, "x_proto": 1, "x_host": 1, "x_port": 1, "x_prefix": 1}
And then:
from werkzeug.middleware.proxy_fix import ProxyFix
self.flask_app.wsgi_app = ProxyFix(
self.flask_app.wsgi_app, **self.config["PROXY_FIX_CONFIG"]
)
Are you sure your X-Forwarded-Proto is set?
(note you can change PROXY_FIX_CONFIG)
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 .pinned to prevent stale bot from closing the issue.