Skip to content

Generated pages are blank when SECURE_SSL_REDIRECT is enabledย #24

@loicteixeira

Description

@loicteixeira

It is sometimes required to set SECURE_SSL_REDIRECT to True in the settings (e.g. you can't force the redirection before the request reaches Django). When you do so however, the generated pages will be completely blank.

This is because the request is not set as secure:
https://github.com/moorinteractive/wagtail-bakery/blob/4c2979956a9601ffd25811314e90b31f713e60c6/src/wagtailbakery/views.py#L91-L92

Which returns a HttpResponsePermanentRedirect which isn't handled (it reaches the 3rd if branch where reponse.content is b''):
https://github.com/moorinteractive/wagtail-bakery/blob/4c2979956a9601ffd25811314e90b31f713e60c6/src/wagtailbakery/views.py#L31-L40

While there might be some discussions to have on how a HttpResponsePermanentRedirect should be handled, I reckon this is for another issue and that the right fix here is to set the request as secure. I'll open a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions