Skip to content
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

Redirect doesn't use SSL #429

Closed
bmaynard opened this issue Apr 16, 2012 · 15 comments
Closed

Redirect doesn't use SSL #429

bmaynard opened this issue Apr 16, 2012 · 15 comments

Comments

@bmaynard
Copy link

After upgrading from 3.8.X to 4.0.2, any redirects from sentry doesn't include https. I have the following setting in sentry.conf.py:

SENTRY_URL_PREFIX = 'https://sentry.blah.com'

but after an action that redirects eg: saving, it redirects to http://sentry.blah.com

@dcramer
Copy link
Member

dcramer commented Apr 16, 2012

This is likely because the application doesn't realize you're actually using SSL (even though you've set the URL prefix). This is currently a known issue that
not everything respects SENTRY_URL_PREFIX (but rather, many respect env[SCRIPT_NAME] and what not).

David Cramer

twitter.com/zeeg
disqus.com/zeeg

On Monday, April 16, 2012 at 8:59 AM, Ben Maynard wrote:

After upgrading from 3.8.X to 4.0.2, any redirects from sentry doesn't include https. I have the following setting in sentry.conf.py:

SENTRY_URL_PREFIX = 'https://sentry.blah.com'

but after an action that redirects eg: saving, it redirects to http://sentry.blah.com


Reply to this email directly or view it on GitHub:
https://github.com/dcramer/sentry/issues/429

@ghost
Copy link

ghost commented Apr 18, 2012

My above issue seems to have resolved itself after I upgraded from 4.0.10 to 4.0.11!

@dcramer dcramer closed this as completed Apr 19, 2012
@dcramer dcramer reopened this Apr 19, 2012
@dcramer dcramer closed this as completed May 13, 2012
@yuris
Copy link

yuris commented Jul 2, 2012

I'm still experiencing this issue

@jwineinger
Copy link

I am seeing this as well. I am hosting sentry via nginx with SSL at the root of a domain. When viewing the dashboard, clicking a project link redirects to http to display the project's stream.

I do have SENTRY_URL_PREFIX set to the appropriate https URL.

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

same problem here w/Nginx + uWsgi + Sentry 5.4.5

@dcramer
Copy link
Member

dcramer commented Jun 23, 2013

You'll need to do some special configuration for SSL

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

Then send the X_FORWARDED_PROTO header in Nginx

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

David,

I must be doing something wrong, it does not work for me.

  1. Added to the server section in nginx conf:
proxy_set_header X-Forwarded-Proto $scheme;
  1. Added the SECURE_PROXY_SSL_HEADER to sentry.conf

Using uwsgi in emperor mode and by accessing https://${virtual_host_address} ends up redirecting to https://${fqdn}/login/

[pid: 10663|app: 0|req: 4/7] 116.250.217.134 () {42 vars in 817 bytes} [Sun Jun 23 18:07:11 2013] GET / => generated 0 bytes in 5 msecs (HTTP/1.1 302) 4 headers in 160 bytes (1 switches on core 0)

Have you got any idea?
Thanks

@dcramer
Copy link
Member

dcramer commented Jun 23, 2013

And you've also set SENTRY_URL_PREFIX ?

On Sunday, June 23, 2013 at 11:10 AM, Jordi Llonch wrote:

David,
I must be doing something wrong, it does not work for me.

  1. Added to the server section in nginx conf:
    proxy_set_header X-Forwarded-Proto $scheme;
  2. Added the SECURE_PROXY_SSL_HEADER to sentry.conf
    Using uwsgi in emperor mode and by accessing https://${virtual_host_address} ends up redirecting to https://${fqdn}/login/
    [pid: 10663|app: 0|req: 4/7] 116.250.217.134 () {42 vars in 817 bytes} [Sun Jun 23 18:07:11 2013] GET / => generated 0 bytes in 5 msecs (HTTP/1.1 302) 4 headers in 160 bytes (1 switches on core 0)
    Have you got any idea?
    Thanks


Reply to this email directly or view it on GitHub (#429 (comment)).

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

Yes,

SENTRY_URL_PREFIX=https://${virtual_host_address}

It looks to me that internal redirections are not forwarded to the right url.

@dcramer
Copy link
Member

dcramer commented Jun 23, 2013

And you've added everything per the documentation? http://sentry.readthedocs.org/en/latest/quickstart/index.html#setup-a-reverse-proxy

Otherwise if you could put your Nginx config here, that would help

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

I am using uwsgi. Does proxy_* settings being honored under uwsgi_pass?

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/sentry.sock;

        uwsgi_connect_timeout 180;
        uwsgi_send_timeout 300;
        uwsgi_read_timeout 600;
    }

I have found the recipe "Running the Sentry server via uWSGI" in http://projects.unbit.it/uwsgi/wiki/TipsAndTricks , works well under http but not in httpS

@dcramer
Copy link
Member

dcramer commented Jun 23, 2013

You have to use the uwsgi proxy settings IIRC, but to be honest, it's not a documented method (for Sentry) so you're kind of on your own.

On Sunday, June 23, 2013 at 11:25 AM, Jordi Llonch wrote:

I am using uwsgi. Does proxy_* settings being honored under uwsgi_pass?
location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/sentry.sock; uwsgi_connect_timeout 180; uwsgi_send_timeout 300; uwsgi_read_timeout 600; }
I have found the recipe "Running the Sentry server via uWSGI" in http://projects.unbit.it/uwsgi/wiki/TipsAndTricks , works well under http but not in httpS


Reply to this email directly or view it on GitHub (#429 (comment)).

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

Thanks @dcramer, I'll try and come back to you with the outcome if you're interested to document and support the feature in Sentry.

@dcramer
Copy link
Member

dcramer commented Jun 23, 2013

That would be great. We try to fully support embedded WSGI applications (via sentry.wsgi), it's just not something we document, so there's that possibility as well.

On Sunday, June 23, 2013 at 11:29 AM, Jordi Llonch wrote:

Thanks @dcramer (https://github.com/dcramer), I'll try and come back to you with the outcome if you're interested to document and support the feature in Sentry.


Reply to this email directly or view it on GitHub (#429 (comment)).

@llonchj
Copy link
Contributor

llonchj commented Jun 23, 2013

That's the solution: add UWSGI_SCHEME into nginx as documented in http://stackoverflow.com/questions/7339666/unwanted-https-http-redirects-with-nginx-uwsgi-flask-app

uwsgi_param UWSGI_SCHEME $scheme;

I will fork sentry and contribute on the docs. English is not my main language, feel free to change anything after the PR.

Thanks for your help, @dcramer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants