heyaphra
heyaphra

Reputation: 469

GitHub Pages not serving projects, renders the root user site instead

I'm serving a React app out of the bloom510.github.io repository. There are 2 branches: source and master. As you might have guessed, source contains the entire non-compiled source code which is then built and deployed to the master branch. This works.

My problem is that other projects hosted on GitHub pages which GitHub says have been published successfully to bloom510.github.io/my_project_name simply load the root site containing the React app. In fact, any arbitrary route loads it without a 404 error. This is occurring on all my devices: Chromebook, MacBook, and Pixel 2 XL. What is going on here?

UPDATE: Currently hosting my main site in /card project and redirecting from main site. Would really like to get the main site working properly.

Links I have been working with:

user page: bloom510.github.io

a project: bloom510.github.io/hello-wasm

an arbitrary route: bloom510.github.io/i-do-not-exist

repo: https://github.com/bloom510/bloom510.github.io

enter image description here

Upvotes: 3

Views: 534

Answers (2)

Wachid
Wachid

Reputation: 617

In my case, it look like it has something to do with react-router-dom v4. I got the fix by changing

<Router basename='/'>
  <App/>
</Router>

into

<Router basename='/yourCurrentRepository'>
  <App/>
</Router>

Seems like react-router-dom redirect your gh-pages into root directory wich is bloom510.github.io instead of bloom510.github.io/my_project_name. Hopefully can help everyone who is also experiencing the same problem.

Upvotes: 0

VonC
VonC

Reputation: 1328152

Another peculiar observation is that loading project URLs in a private window actually works

I do see the "Hello World" using Rust and WebAssembly using http://bloom510.github.io/hello-wasm, in a non-private session.
Since the repo has a gh-pages branch, its content is published.

project repo

So make sure you can reproduce the issue (in different browser or computer)

Upvotes: 0

Related Questions