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.

historyApiFallback not working

See original GitHub issue

Hi, thank you very much for this repo. I want to use the plugin for my new svelte spa app.

My config looks like this:

serve({
    contentBase: 'dist',
    port: 5000,
    historyApiFallback: true
}),

But the historyApiFallback isn’t working. When i go to localhost:5000/solutions/technic i still get 404 Not Found and i don’t see the index.html

How can i solve this?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
thghcommented, Sep 23, 2019

Could be interesting to make a repo so we can see what’s going wrong.

1reaction
gabrielizaiascommented, Sep 12, 2019

when i change the script-tag in the index.html like this: <script src="dist/main.js"></script> it doesn’t work.

Does that mean you removed the leading forward slash? You have to add it, otherwise any request to a nested route like http://example.com/lorem/ipsum will try to load your script from http://example.com/lorem/ipsum/dist/main.js, which is why it fails.

There doesn’t seem to be anything wrong in your rollup.config.js from what I can tell.

Read more comments on GitHub >

github_iconTop Results From Across the Web

historyApiFallback doesn't work in Webpack dev server
historyApiFallback.index indicate that when url path not match a true file,webpack-dev-server use the file config in historyApiFallback.index to ...
Read more >
historyApiFallback troubles with webpack-dev-server and ...
If you are using React Router for your SPA (Single Page App) routing, and are running into a problem where hitting a url...
Read more >
historyApiFallback not doing rewrites in webpack 5 #1986
I can't use only one file in index.html in my case because I need 2 'apps' (each with a different path), to be...
Read more >
connect-history-api-fallback - npm
Start using connect-history-api-fallback in your project by running `npm i connect-history-api-fallback`. There are 1355 other projects in ...
Read more >
Top 5 connect-history-api-fallback Code Examples - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
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