meeb/django-distill

If SECURE_SSL_REDIRECT = True it fails with CommandError: View returned an invalid status code: 301 (expected one of (200,))

Closed this issue · 3 comments

Great Jamstack tool btw!

The workaround is simple. Set SECURE_SSL_REDIRECT = False. If it's True it will return

Loading site URLs
CommandError: View returned an invalid status code: 301 (expected one of (200,))

This should probably be documented somewhere.

meeb commented

Thanks!

To trigger this are you hosting a dynamic site behind an HTTPS enabled proxy as well as integrating distill for some pages? What's your setup here? If you provide some details I'll look at the correct docs updates to cover this.

I'm using Docker for my local sandbox and am proxying it via nginx to proxy https pages that are generated by Django's runserver. The site URL actually contains https for development (although http also works). It's a standard setup we use internally to avoid browser restrictions when working when non https in certain cases. If you're having problems recreating it, let me know and I can maybe create a clean docker setup to recreate the issue.

I can see maybe in a production environment where only some of the pages are to be distilled this could be a larger problem. But for me, the workaround works just fine for this.

Also, I'd like to point out the the docs for publishing to production are fantastic. I was able to get it all going rather quickly despite this one roadblock.

meeb commented

I've added a note to the readme detailing your situation and work-around for now:

https://github.com/meeb/django-distill/blob/master/README.md#developing-locally-with-https

Hopefully this is sufficient. Feel free to modify the README and submit a PR if you want to add any more specifics.

Cheers for the issue.