Garbled/Unreadable content on 404 not found pages

What is the name of the domain?

dreamsfaq.com

What is the issue you’re encountering

When visitors hit a 404 not found page, my site responds with weird garbled/unreadable content

What steps have you taken to resolve the issue?

I have no idea how to fix it, but i think it has something to do with my cloudflare setup, because as a test, i deployed another instance of the site and used the built-in domain from my hosting provider, and the 404 responses i get there are the standard browser built-in “This page can’t be found”…

What are the steps to reproduce the issue?

Just go to dreamsfaq.com/asdiohfajksdfh (this slug will result in a 404)

Screenshot of the error

When I make that request with Brave, I get what you get. But if I copy that as curl and request it directly from your railway-edge server, I get nothing:

> GET /asdfasdfasdfasdf HTTP/2
> Host: dreamsfaq.com
> accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8
> accept-language: en-US,en;q=0.9
> cache-control: no-cache
> pragma: no-cache
> priority: u=0, i
> sec-ch-ua: "Brave";v="129", "Not=A?Brand";v="8", "Chromium";v="129"
> sec-ch-ua-mobile: ?0
> sec-ch-ua-platform: "macOS"
> sec-fetch-dest: document
> sec-fetch-mode: navigate
> sec-fetch-site: none
> sec-fetch-user: ?1
> sec-gpc: 1
> upgrade-insecure-requests: 1
> user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
> 
* Request completely sent off
< HTTP/2 404 
< content-type: text/html;charset=utf-8
< date: Sun, 29 Sep 2024 13:42:48 GMT
< server: railway-edge
< vary: Accept-Encoding
< x-powered-by: Nuxt
< x-railway-request-id: _1M7By2zQ6moxVyJlT_XaA_3118653284
< x-request-start: 1727617368508
< x-robots-tag: index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1
< 
* Connection #0 to host 35.xxx.xx.xx left intact
@KidMac %                                                   

A plain curl response through Cloudflare returns JSON:

> GET /asdfasdfasdfasdf HTTP/2
> Host: dreamsfaq.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 404 
< date: Sun, 29 Sep 2024 13:47:03 GMT
< content-type: application/json
< content-length: 115
< vary: Accept-Encoding
< x-railway-request-id: 89MObLxaQaOP7lyqoCYT4Q_1850849526
< x-request-start: 1727617623764
< x-robots-tag: index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=Wams3EGeJdDjQr5z4AwpJk%2FlNe%2Fmtje90hw%2FCU8UwkgIVtLOarP%2B6FP%2BmvlFMStjVCw%2B4EyizhW1p%2BBVCgztZE6AJ3VtLYvqC6VGcC3lEeClinBZhzYPI84gdQU2sqStv1xXyyj1aa2VQAMM"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< cf-ray: 8cac6c43a8a67eab-LAX
< 
* Connection #0 to host dreamsfaq.com left intact
{"url":"/asdfasdfasdfasdf","statusCode":404,"statusMessage":"Page not found","message":"Page not found","stack":""}%    

I get the same JSON when connecting directly to your server.

There’s something odd about how it responds for 404s, depending on the request it gets.