question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirect loop 302

See original GitHub issue

Hi,

Since this morning I’ve got a redirect loop when trying to login to Redash. My version is the latest stable (v0.9.2.b1536).

Here is what I’ve got:

$ curl -I redash.antoine-augusti.fr
HTTP/1.1 302 FOUND
Server: nginx/1.4.6 (Ubuntu)
Date: Fri, 01 Apr 2016 08:33:52 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 313
Connection: keep-alive
Location: http://redash.antoine-augusti.fr/login?next=http%3A%2F%2Fredash.antoine-augusti.fr%2F
Set-Cookie: session=eyJfaWQiOnsiIGIiOiJaVFpsTnpNMVpqYzRZelkzTmpNNE9XTXpOakF6TURsa09ESmlOREE1TURrPSJ9fQ.Cd_D8A.UUXGQK77l4fJqQrTdGAdtAiXzq4; HttpOnly; Path=/

I’ve tried restarting the redash webserver without success.

It seems like I’ve got a 500 on the index page, but I can’t find the reason (from api_error.log):

[2016-04-01 08:46:16,479][PID:8117][INFO][metrics] method=GET path=/login endpoint=login status=302 content_type=text/html; charset=utf-8 content_length=273 duration=2.66 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,480][PID:8117][INFO][metrics] method=GET path=/login endpoint=login status=500 content_type=? content_length=-1 duration=3.58 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,572][PID:8118][INFO][metrics] method=GET path=/ endpoint=index status=302 content_type=text/html; charset=utf-8 content_length=313 duration=2.80 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,573][PID:8118][INFO][metrics] method=GET path=/ endpoint=index status=500 content_type=? content_length=-1 duration=3.68 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,670][PID:8126][INFO][metrics] method=GET path=/login endpoint=login status=302 content_type=text/html; charset=utf-8 content_length=273 duration=2.59 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,671][PID:8126][INFO][metrics] method=GET path=/login endpoint=login status=500 content_type=? content_length=-1 duration=3.48 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,765][PID:8123][INFO][metrics] method=GET path=/ endpoint=index status=302 content_type=text/html; charset=utf-8 content_length=313 duration=2.74 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,766][PID:8123][INFO][metrics] method=GET path=/ endpoint=index status=500 content_type=? content_length=-1 duration=3.62 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,857][PID:8117][INFO][metrics] method=GET path=/login endpoint=login status=302 content_type=text/html; charset=utf-8 content_length=273 duration=2.58 query_count=0 query_duration=0.00
[2016-04-01 08:46:16,858][PID:8117][INFO][metrics] method=GET path=/login endpoint=login status=500 content_type=? content_length=-1 duration=3.46 query_count=0 query_duration=0.00

I can access the CLI without any errors by running sudo -u redash bin/run ./manage.py from /opt/redash/current

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
AntoineAugusticommented, Apr 5, 2016

After checking this with @arikfr on Gitter, we found that this was caused by the Flask-Login module.

For some reasons, the installed version on my system was the right and required one, but the source code was different than on GitHub. Specifically, the is_authenticated method on the AnonymousUserMixin was not a property. As such, the conditional was always evaluated to true, causing the redirect loop.

This issue was solved with the following commands:

sudo pip uninstall Flask-Login
cd /opt/redash/current && sudo pip install -r requirements.txt
0reactions
arikfrcommented, Apr 5, 2016

Can you log the type of current_user.is_authenticated?

AnonymousUser includes the AnonymousUserMixin which supposed to return static False for is_authenticated, so it’s really strange that it gives you “Thinks auth” in logs.

If you like, ping me over Gitter so we can try things in “realtime”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my 301/302 stuck in a redirect loop? - Stack Overflow
This involves moving a section at a time and creating 301 redirects to the new site. I previously used this code to redirect...
Read more >
How To Fix the HTTP 302 Error (5 Methods) - Kinsta
It's only an error if your website is responding with 302 codes that it shouldn't be issuing, or if it's causing a redirect...
Read more >
Multiple browsers result in 302 redirect loop to Publisher Center
It works properly only when logged into a Gmail account outside of our G Suite domain. Details. Publisher Center troubleshooting.
Read more >
Receiving "Too Many Redirects" on Browser - Kemp Support
Redirect loops are caused when the client receives a status code that falls within the redirection class, such as a 301 or 302...
Read more >
Nginx 302 redirect loop debugging - Server Fault
after making some changes, i am stuck with a 302 redirect loop on one location directive called /login. it keep redirecting to 302...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found