meeb/django-distill

Is it possible to add a header file while using cloudflare pages??

Closed this issue · 2 comments

I am interested in knowing if we could add a header file to the static site as suggested by cloudflare here .
It's because I want to show a 404 for pages that doesn't exist. They are returning 200 status.

meeb commented

Sure, the _headers file is just a normal plain text file. Create a view for it and write it out like any other content. The django-distill.com site is hosted on Cloudflare pages and writes a _headers file along with handlign 404s properly. See:

https://github.com/meeb/django-distill-site/blob/main/distill_site/common/views.py#L27

https://github.com/meeb/django-distill-site/blob/main/distill_site/common/views.py#L52

Your questions so far are mostly covered in the extensive documentation or have full examples written for them.

Thankyou. I got it