2
votes

I have a custom 404 handler that I use for my Django app running the CMS Wagtail. Everything works great with replacing the Django handler404 with a view function of my choosing. Except that it seems to break Wagtails 301 redirect feature. All of the redirects I have now just go to a 404 page. Below is how I am using handler404 in the base app,

handler404 = siteapp_views.handler404
1
What does your 404 handler look like? If it doesn't return a response with status_code=404, then that will probably break Wagtail's redirect middleware - Alasdair
This was the problem. I needed to return a 404 status and it worked great. Thank you. - David B

1 Answers

5
votes

Your 404 handler must return a response with status_code=404, otherwise the Wagtail redirect middleware will not work.