How do I serve homepage

For Workers & Pages, what is the name of the domain?

https://c24f4684.repair-cafe.pages.dev/

What is the error number?

404

What is the issue or error you’re encountering

Homepage not being served

What steps have you taken to resolve the issue?

I have uploaded an index.html (see picture) but the link above gives me a 404. What is needed to get my `index.html to be served.

I have pages_build_output_dir = "./dist" in my wrangler.toml file and have tried with a server.ts that was empty, so there could be no conflicting routes.

Screenshot of the error

Looks like you’re using remix - Route Configuration | Remix

no that’s just a coincidental name

Ok well, there’s gonna be some Function (Functions · Cloudflare Pages docs) running through some framework or not that’s clearly not working properly.

We can’t debug it without having the code or you giving anymore info. So, the best I can say is to look at the code and try to debug it.

Thanks for trying to help. There is no code though. I want a completely static site that I can share as abc.pages.dev

You must have code at the minute otherwise that index.html would be served and there’s no 404.html but there is a custom 404 page being served.

You’re gonna need to help me help you here, I can’t do much with the info we have.

For a static site you just need to npx wrangler pages deploy <folder> or have no build command if using Git builds and put the output dir.

2 Likes

Aha. The mere presence of _worker.ts - even though it had no routes programmed (by me at least; the file had quite a lot of default hono code in it) was enough to block everything. Removing that from the picture seems to have got things working

Not sure what I do if I do need some server routes one day but I think I am unblocked today

Yeah _worker is basically a way to say “run everything through this”

It requires manual config to define includes/excludes which can be done with: Routing · Cloudflare Pages docs

The functions folder is the recommended way: Functions - Get started · Cloudflare Pages docs

That’s interesting. I understand that Cloudflare Pages in some way work with /functions but all the setup scripts seem to create a /src/index.{js|ts|jsx}. The Cloudflare script to create Pages also includes main=... in wrangler.toml, which basically turns it in a Cloudflare Worker against your wishes.

Pages feel very much like second class citizens