Skip to content
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

feat: 404 and catchall handling #2175

Merged
merged 5 commits into from Nov 19, 2022
Merged

feat: 404 and catchall handling #2175

merged 5 commits into from Nov 19, 2022

Conversation

adamdbradley
Copy link
Contributor

@adamdbradley adamdbradley commented Nov 18, 2022

Breaking Change

  • trailingSlash defaults to true now, previously defaulted to false

404 Handling

  • Add ability to create custom 404.tsx
  • Starting at the original request path, use the first custom 404 found, and climb up the directories until one is found
  • Use a default 404.html if no custom 404.tsx
  • Generate static 404 content that can be used in any edge function or node server

Route Handling

  • Check if path is a known static file before routing to SSR
  • Create catchall routes at the edge function level
  • Ability to also manually add staticPaths to the known paths
  • Do not create any static index.html files that should be handled by SSR

E2E Tests

  • Fix qwik-city e2e tests with updated trailing slash default

@stackblitz
Copy link

stackblitz bot commented Nov 18, 2022

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@cloudflare-pages
Copy link

cloudflare-pages bot commented Nov 18, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03476ed
Status: ✅  Deploy successful!
Preview URL: https://d41cb71d.qwik-docs.pages.dev
Branch Preview URL: https://catchall-404.qwik-docs.pages.dev

View logs

}
if (id.endsWith(qwikCityNotFoundPaths)) {
const notFoundHtml = getErrorHtml(404, 'Resource Not Found');
return `export function getNotFound(){ return ${JSON.stringify(notFoundHtml)}; };`;

Check warning

Code scanning / CodeQL

Improper code sanitization

Code construction depends on [an improperly sanitized value](1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant