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.

502 error on large previews when SESSION_ENGINE is set to signed_cookies

See original GitHub issue

Issue Summary

We are trying to preview a page on wagtail. It seems previews are store in session unlike drafts. And we have a huge description text. So we are getting 502 error on preview.

Cookie length should be less than or equal to 4096 characters.

Drafts and live are working fine with this session engine.

Steps to Reproduce

  1. Set SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies' in settings.py
  2. login to cms
  3. go tp pages
  4. create a new child page or edit existing.
  5. Add big text in description i.e sample text
  6. click preview

cc @pdpinch

Screens:

screen shot 2018-05-08 at 12 02 01 am screen shot 2018-05-08 at 12 02 07 am

Technical details

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gasmancommented, Jul 5, 2018

@blarghmatey By definition, I think a preview has to show the outcome of a proposed change without committing that change to the database (even just as a draft revision). If an editor hits preview, and then changes their mind about their edit, and navigates away without saving, the system should behave as if the edit was never made at all (and thus revisiting the edit view should take you back to the page’s original state).

1reaction
loicteixeiracommented, May 17, 2018

Thanks for the report @amir-qayyum-khan.

For reference, preview data is stored in the session since #3383. While #3583 reduces preview data size, the issue will essentially still exists.

The fact that it might exceed the cookies max-size was raised at the time but it was agreed to add a warning to the documentation (although it seems to have never happened) given that not using the session probably meant creating an API endpoint which would have been a lot more work. Maybe it will be time to revisit this.

In the meantime, you should be able to configure uwsgi to accept bigger cookies (IRRC, nginx has some sort of auto-scaling but uwsgi doesn’t).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix a 502 Bad Gateway Error - Kinsta
The 502 Bad Gateway error specifically means that the server received an invalid response from an inbound server.
Read more >
502 Bad Gateway Error - Support Center - WP Engine
Any 50x error means that some request to the server didn't return a proper result. A 502 specifically means that there was a...
Read more >
What is a 502 Bad Gateway and how do you fix it? - IT PRO
A 502 Bad Gateway error rarely lasts very long and is usually in the process of being solved by the site administrator by...
Read more >
502 Bad Gateway - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 502 Bad Gateway server error response code indicates that the server, while acting as a gateway or proxy, ......
Read more >
502 Bad Gateway Error [Solved] - freeCodeCamp
But sometimes, the browser might show this error due to past-due updates, ad-blockers, browser extensions and plugins, or even DNS server ...
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