Issues with 502 on access

Hi @peter5, I’m having a similar issue and it’s caused by a large cookie. Try deleting them one by one and see which one is the culprit.

HOWEVER, this isn’t normal. Had it not been for CloudFlare, the origin server doesn’t show a 502 error.

Can CloudFlare help with this?

1 Like

Havig the same issue here with a brand new account.

1 Like

The above tip summarizes the troubleshooting steps, if you’re seeing a plain black & white screen, there is an issue with cloudflare. If you’re seeing a color screen, it’s something with your origin. That should show in the logs and can but from any http device along the way.

1 Like

Perfect, yes… I’m seeing 502 on nginx, but only if I use Cloudflare Access
This is the response

2020/08/28 00:26:46 [error] 2683#2683: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client:, server: _, request: "GET /admin/ HTTP/1.1", upstream: "", host: "", referrer: "<REDACTED>.eASK69flnCOfx9OTunIkJj41Vz5bx52XGXc9W2Yly1Hsl7c0uj0LDkennoVl-haQr1lg3IiLVgDWRB2-IPy-e4j2bD4HOlR6eFQ-mB2ZVWuXCL3XVxkwOV_WwQInRQmh-FUOuwW-DR2XlYgJ03byT28LQmWwhPf8uRZ1LQQK3G7j7L3yZLolnQT_ETy_khv_WZ5-oKTcwiCHERq893AVDBs4fWLRyLEKIPGxTTSSBEN-S44Kj20OZuWY5UKxtWJ8nBvDARqmJ4V-3spdgBT2gZLPwhxReCSTQZonPeX6gAWdwb9ukOpYDl564OzzfN_c7B_PovLKfQCsBXYcHufhBQ&v=5f484eb0"

I tried to increase proxy_buffers in nginx, still the same

I think this is related to the POST we are doing to login, after refresh the Admin looks ok.
Could be that?

1 Like

We are having problems when visiting the site after some time. It gives 502, and refresh helps it.

I will add better logging in case we are returning 502 from our server due to some cookies or something being sent from the browser.

Anyone that experience this with Django Admin?

Yes! We had the same issue here…
The solution was increase the buffer size inside uwsgi.

buffer-size = 32768

So it was uwsgi that responds with 502 for you? Not the Django app it self? I’ll try that out :slight_smile:

I found some issues when read the wsgi log… Something about max content of 4096 limit.
After probably a few hours of dig into stackoverflow I found that solution. I found this thread as well, but nobody had the right answer :smiley:
Hopefully that helps!

1 Like

We had exact same error and situation.
UWSGI serving a Django app with Cloudflare Access turned on the /admin route.
We could access /admin but when saving content (posting) we got the CF error.
Increasing the buffer-size to 32768 in the uwsgi.ini fixed it.
Thank you and thanks google for indexing this page :slight_smile: