@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?
Havig the same issue here with a brand new account.
Try the suggestions in this Community Tip to help you fix Error 502 / Error 504: Bad Gateway / Gateway Timeout.
The 502 / 504 errors are quite similar. Generally, a HTTP 502 / 504 errors occurs because your origin server (e.g. your web host) is returning this code to us, and Cloudflare returns this code in turn to your visitors. They are caused by a problem connecting to an upstream server - meaning your server is trying to initiate a process and this fails to work as expecte…
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.
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: 10.100.10.24, server: _, request: "GET /admin/ HTTP/1.1", upstream: "http://127.0.0.1:8000/admin/", host: "my.domain.com", referrer: "https://xxx.xxx.com/cdn-cgi/access/login/my.domain.com?kid=fd2b9274bc507f95b98278684a9a5a2901406a93fe38a77bb319cec11261854e&redirect_url=%admin%2F&meta=eyJraWQiOiJhNmFjOGFhZGZkN2JiZGY3OWU5YWFlOThkZWQwZDA3YWY1MzhhZTYzMjVlMjIxMzRjZDE2MjgxZGJhOGM2YWZjIiwiYWxnIjoiUlMyNTYiLCJ0eXAiOiJKV1QifQ.<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?
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
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
Hopefully that helps!