【问题标题】:Bug about Nextjs routing关于 Nextjs 路由的错误
【发布时间】:2020-10-31 04:14:35
【问题描述】:

首先,在开发时(纱线开发),没有路由问题。将应用程序部署(npm 构建、导出和部署)到 firebase 后,重新加载页面或尝试直接打开页面,导致响应 404 找不到页面,尽管它存在。假设打开主页,然后使用 next/link 或 next/router (Router.push('/page1')) 访问另一个页面,没问题。例如;

www.firebaseapp.web.app/ -> /page1 -> /page2 // rendering page
www.firebaseapp.web.app/page2 // 404 not found
www.firebaseapp.web.app/page2.html // rendering page. i noticed later.

那么,当用户尝试直接访问页面时,为什么nextapp没有正确响应或将/page1重定向到/page1.html?

【问题讨论】:

    标签: next.js next-router


    【解决方案1】:

    查看rewrites https://firebase.google.com/docs/hosting/full-config#rewrites

    firebase 代理可能需要额外的配置 - 下一个甚至可能没有收到请求

    【讨论】:

      猜你喜欢
      • 2021-07-16
      • 2020-12-11
      • 1970-01-01
      • 2021-08-09
      • 2023-02-16
      • 1970-01-01
      • 2021-09-05
      • 2023-02-19
      • 1970-01-01
      相关资源
      最近更新 更多