I have a single page app built with a custom webpack config. Nothing terribly exciting. Previously I’d been running the webpack-dev-server and enabling the history fallback (unmatched urls to index.html) But I want to use the netlify dev server so I don’t have to duplicate my api proxy declarations, and so I can use the --live mode. However the rewrites don’t seem to be functioning correctly.
This is my netlify.toml
[build]
command = "yarn build"
publish = "dist/"
[dev]
command = "yarn webpack-dev-server" # Command to start your dev server
port = 9000 # Port that the dev server will be listening on
targetPort = 9002 # Port of target app server
publish = "dist/"
autoLaunch = true # a Boolean value that determines if Netlify Dev launches the local server address in your browser
This is my _redirects file
/* /index.html 200
Currently I have 2 routes configured / and /home, they both point to the same page.
When I navigate to localhost:9000 I see the home page, but when I go to: localhost:9000/home I see the following message:
Cannot GET /home/index.htm
When I change my _redirects file to be like this:
/home /index.html 200
/* /index.html 200
Everything seems to be working. Given the documentation here: rewrites-proxies It seems like I’m doing this correctly, and it’s working when I deploy the site.