Closed ChrisLMerrill closed 7 years ago
It sounds like you need to set historyApiFallback: true
in your Webpack config. Here are the docs:
https://webpack.js.org/configuration/dev-server/#devserver-historyapifallback
Let me know if that fixes your problem!
mhink's answer is good for webpack dev server.
I think you've got the gist of it. The steps can vary depending on your configuration.
I'm building an app that's currently served from a Laravel backend (which handles login + api), and I've configured the Laravel router to serve my redux app for anything starting with /app/
. This way, 404s on the Laravel app still work properly. I could have also done this at the nginx level.
It's kind of up to you. Because of the infinite variations on server configurations, I would say these issues are within the scope of the server you're using.
I think @mhink 's solution should fix your problem! Like @nnjpp said, this can vary depending on your server/configuration, but definitely works for WDS.
I have the very basics working with redux-little-router - I've basically cloned the demo. I'm new to react, redux and rlr. My (very simple) app has some links, which change the URL and then the content displayed. But using that URL directly or pressing the refresh button results in a 404.
E.g.
I understand that the webserver has no clue what /path1 is...thus the 404. I think I know how to solve it on my webserver (serving the index.html for /*) but not sure how to solve it in my dev environment (I'm using yarn and webpack-devserver).
My question is: Am I missing something else? How do you usually solve this problem? Is this outside the scope of rlr?
TIA! Chris