Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to prerender *404 page? #1574

Closed
2 tasks done
huseeiin opened this issue Jul 3, 2024 · 3 comments
Closed
2 tasks done

How to prerender *404 page? #1574

huseeiin opened this issue Jul 3, 2024 · 3 comments

Comments

@huseeiin
Copy link
Contributor

huseeiin commented Jul 3, 2024

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

when i prerender /about it creates a about/index.html file correctly. but when i prerender "/*404" it generates nothing.

Expected behavior 🤔

No response

Steps to reproduce 🕹

import { defineConfig } from "@solidjs/start/config";

export default defineConfig({
  server: {
    preset: "cloudflare-pages",
    prerender: { routes: ["/*404"] },
  },
});

Context 🔦

No response

Your environment 🌎

No response

@huseeiin huseeiin added the bug Something isn't working label Jul 3, 2024
@huseeiin huseeiin changed the title [Bug?]: how to render *404 page? [Bug?]: how to prerender *404 page? Jul 3, 2024
@huseeiin
Copy link
Contributor Author

huseeiin commented Jul 3, 2024

I dont think this is possible with Nitro? I'm not sure this is a SolidStart problem?

well, since solidstart uses nitro, it is a solidstart problem even if it originates from nitro

@mdynnl
Copy link

mdynnl commented Jul 5, 2024

using the code provided with these versions

├── @solidjs/[email protected]
├── @solidjs/[email protected]
├── @solidjs/[email protected]
├── [email protected]
└── [email protected]

cloudflare-pages

Screenshot 2024-07-06 at 05 57 59 but you probably don't need it for this preset as workers can already serve a 404 page

cloudflare-pages-static

import { defineConfig } from '@solidjs/start/config';

export default defineConfig({
  server: {
    preset: 'cloudflare-pages-static',
    prerender: {
      // crawlLinks: true, // required for `cloudflare-pages` preset
      autoSubfolderIndex: false,
      routes: ['/404'],
    },
  },
});

This might be what you want which also generates a redirect rule /* /404.html 404 which for some reason
is not supported yet
But 404.html will be detected and will be used as 404 redirection expcept for /404 which returns 200

Screenshot 2024-07-06 at 06 27 31

@ryansolid
Copy link
Member

I would expect you to be able to put /404 and have it work because it doesn't exist. The thing is 404 page doesn't exist so to make it exist you need to put it in the list. And it should match the star route. From there you can set up your redirect rules in your provider to point to that page.

@ryansolid ryansolid changed the title [Bug?]: how to prerender *404 page? How to prerender *404 page? Sep 25, 2024
@ryansolid ryansolid removed the bug Something isn't working label Sep 25, 2024
@solidjs solidjs locked and limited conversation to collaborators Sep 25, 2024
@ryansolid ryansolid converted this issue into discussion #1633 Sep 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants