question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serve page on github-pages

See original GitHub issue

Hello, I have problem serving my app on gh-page. In development mode everything works fine. In production environment (I’m hosting on gh-pages) I can’t visit my sub-pages directly. That is I can’t go directly to e.g. https://preview.pro.ant.design/dashboard/analysis because it throws me github 404 page. Instead I have to go first to https://preview.pro.ant.design, and then to the dashboard/analysis through umi router. I’ve copied the exact config that this project has, but it still doesn’t work. How does the https://preview.pro.ant.design solved this issue ? It looks like it’s hosted on gh-pages as well https://github.com/ant-design/ant-design-pro/tree/gh-pages . And it doesn’t use history : { type: 'hash' } how did they achieve it ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:11

github_iconTop GitHub Comments

1reaction
huntdreamcommented, Jul 6, 2020

@huntdream I’m confused. Are you saying that you fixed the problem? Was the solution to just add a 404.html or 404.md file in the /dist folder?

Does that mean that every time we run npm run build we will have to manually copy that 404 file over?

Yes, you just need to add a custom 404.html to override the default 404 page of Github Pages I think you can just cp index.html 404.html

1reaction
christopherkaocommented, Jul 5, 2020

@stasbar I’ve tried setting in config.js:

export default defineConfig({
  base: '/',
  publicPath: '/',
...
}

After building and re-deploying to Github Pages, my site at http://finances.fyi/home-mortgage still returns the Github 404 error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub Pages | Websites for you and your projects, hosted ...
Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
Read more >
About GitHub Pages
GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs...
Read more >
Creating a GitHub Pages site
You can create a GitHub Pages site in a new or existing repository. GitHub Pages is available in public repositories with GitHub Free...
Read more >
Quickstart for GitHub Pages - GitHub Docs
In the upper-right corner of any page, use the drop-down menu, and select New repository. · Enter username.github.io as the repository name. ·...
Read more >
Basic steps for hosting on Github
Steps for Hosting a Website on GitHub · Create a GitHub account on github.com. · Download either GitHub for Mac or GitHub for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found