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

<a href="/[some_dynamic_page]"/> will cause 404 in prod mode #536

Closed
himself65 opened this issue Feb 26, 2024 · 10 comments
Closed

<a href="/[some_dynamic_page]"/> will cause 404 in prod mode #536

himself65 opened this issue Feb 26, 2024 · 10 comments
Assignees

Comments

@himself65
Copy link
Sponsor Contributor

himself65 commented Feb 26, 2024

workaround is to use Link

@himself65 himself65 changed the title <a href="/"/> will cause 404 in prod mode <a href="/"/> will cause 404 in prod mode Feb 26, 2024
@himself65
Copy link
Sponsor Contributor Author

Seems like it's the issue on dynamic page

@dai-shi
Copy link
Owner

dai-shi commented Feb 26, 2024

Thanks for reporting. Can we reproduce it with examples/01_template with changing render: 'dynamic' for path: '/'?

@himself65
Copy link
Sponsor Contributor Author

Thanks for reporting. Can we reproduce it with examples/01_template with changing render: 'dynamic' for path: '/'?

im adding the test case now

@himself65 himself65 changed the title <a href="/"/> will cause 404 in prod mode <a href="/[some_dynamic_page]"/> will cause 404 in prod mode Feb 26, 2024
@himself65
Copy link
Sponsor Contributor Author

Oh, I think it's my custom app logic issue, here is fallback in waku start

  if (!options.ssr) {
    // history api fallback
    app.use(
      '*',
      serveStatic({
        root: path.join(distDir, publicDir),
        rewriteRequestPath: () => '/',
      }),
    );
  }

@dai-shi
Copy link
Owner

dai-shi commented Feb 26, 2024

what's your custom app logic? is your options.ssr false?

@dai-shi dai-shi self-assigned this Feb 26, 2024
@himself65
Copy link
Sponsor Contributor Author

Yeah, I disabled SSR because it's a electron app, which run waku

@dai-shi
Copy link
Owner

dai-shi commented Feb 26, 2024

Is it specific to /? I wonder if it causes the same issue with path: '/foo/[id]'.
It might be related to #534, which i'm currently working on.

@himself65
Copy link
Sponsor Contributor Author

Closing as this is not a bug in waku, but still need to update the document and cover the test

Solution: #536 (comment)

@dai-shi
Copy link
Owner

dai-shi commented Feb 27, 2024

Okay, I think I understand the problem.
When / is dynamic, we don't create dist/public/index.html,
then history api fallback doesn't work.
(I will think about it.)

@himself65
Copy link
Sponsor Contributor Author

Okay, I think I understand the problem. When / is dynamic, we don't create dist/public/index.html, then history api fallback doesn't work. (I will think about it.)

Maybe we should fall back to SPA?

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

No branches or pull requests

2 participants