简体   繁体   English

关于资产检索的 404:React 应用程序部署在具有自定义域的 Github 页面上

[英]404 on asset retrieval: React App Deployed on Github Pages with Custom Domain

I have deployed my react app (created with CRA) to github pages.我已将我的反应应用程序(使用 CRA 创建)部署到 github 页面。 I have the gh-branch, and everything works fine when deployed without the custom domain.我有 gh-branch,并且在没有自定义域的情况下部署时一切正常。

Then I add my custom domain, and a white page appears.然后我添加我的自定义域,然后出现一个白页。 The console shows this:控制台显示:

控制台输出

The network tab shows this:网络选项卡显示:

网络选项卡输出

It seem as if it hits the custom domain fine, and then cannot return the build items.似乎它很好地击中了自定义域,然后无法返回构建项。 I've searched online and can't find a solution to this specific example.我在网上搜索过,找不到这个具体例子的解决方案。

My dns setup:我的 dns 设置:

dns 设置

As soon as i remove the custom domain it all works fine again.一旦我删除了自定义域,它就会再次正常工作。

React scripts:反应脚本:

反应脚本

Homepage definition in package.json: package.json中的主页定义: package.json: 主页定义

CNAME file: CNAME 文件:

CNAME 文件

Github pages setup: Github 页面设置: 在此处输入图像描述

Terminal output from the dig command:来自 dig 命令的终端 output:

dig holoapes.com 的终端输出

What's my dns output:我的 dns output 是什么: whatsmydns 网站输出

Any help / tips deeply appreciated非常感谢任何帮助/提示

I fixed this by updating my "homepage" package.json url to the custom domain.我通过将我的“主页”package.json url 更新到自定义域来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM