Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

404 page doesn't render in HTML but plain text #62

Closed
roshanjonah opened this issue May 7, 2022 · 1 comment
Closed

404 page doesn't render in HTML but plain text #62

roshanjonah opened this issue May 7, 2022 · 1 comment

Comments

@roshanjonah
Copy link

Hi there,

I think this is a bug in Cloudflare Workers.

We are using Hugo and Cloudflare workers to push our static site, and Github does the automatic build and push.

% curl -svo /dev/null https://jonahnz.com/404.html

  • Trying 104.21.25.56:443...
  • Connected to jonahnz.com (104.21.25.56) port 443 (#0)
    ...
    < HTTP/2 200
    < date: Thu, 05 May 2022 16:55:39 GMT
    < content-type: text/html; charset=utf-8
    < content-length: 1159

That seems to have content type but not this random 404 address:
% curl -svo /dev/null https://jonahnz.com/non-existing-URL

  • Trying 104.21.25.56:443...
  • Connected to jonahnz.com (104.21.25.56) port 443 (#0)
    ...
    < HTTP/2 404
    < date: Thu, 05 May 2022 16:57:03 GMT
    < content-length: 1159

For some odd reason, the HTML is not rendering so if there is a non-existing URL like https://jonahnz.com/randskdfskuh - you can see it displays just raw HTML rather than outputting this page https://jonahnz.com/404.html

@lukeed
Copy link
Contributor

lukeed commented May 7, 2022

This behavior doesn’t come for free with Workers but it does with Pages. Sounds like you should be using that for this project — you can still deploy a sibling Worker alongside your Pages project if you have any dynamic endpoints

@lukeed lukeed closed this as completed May 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants