我有一个正在运行的应用程序 ( http://simple-pen.surge.sh )。这是使用 React/Redux 构建的前端和 Rails 构建的后端。当我进入网站时,我可以注册或登录并为用户颁发 JWT 令牌。登录后,我有一组可以查看的笔记本。但是,只有在单击笔记本时,我才会被重定向到 404 Page Not Found 错误。
我不确定为什么在向某些页面发出 GET 请求时出现错误。尝试访问“ http://simple-pen.surge.sh/notebooks/1/notes ”网址,但失败。在一种情况下,我设置了它,如果用户登录,“simple-pen.surge.sh”根路径会将用户重定向到他们的笔记本路由,即“ http://simple-pen.surge.sh/notebooks " 呈现页面,但是当我直接对该 URL 发出实际请求时,我会收到错误消息。
以下是分别指向 React 和 Rails 应用程序的 GitHub 存储库的链接。 https://github.com/jamesvphan/simplepen-react https://github.com/jamesvphan/simplepen
关于为什么会发生这种情况的任何帮助或知识都会很棒!
更改 package.json 中的构建步骤
"build": "react-scripts build && cp build/index.html build/200.html"
Run Code Online (Sandbox Code Playgroud)
来源:https : //medium.com/superhighfives/serving-client-side-routing-with-surge-sh-7b705542cf3
| 归档时间: |
|
| 查看次数: |
6286 次 |
| 最近记录: |