I'm trying to deploy a React PWA with React Router to a subdirectory in cloudfoundry. After following the instructions, I get the index.html file for every route, including my static files. I'd like for the index.html file to be the fallback instead of the first choice.
Directory structure:
build/
Staticfile
nginx/
conf/
includes/
push_state.conf
my_subdirectory/
foo/
bleh/
script.js
bar/
blah/
file.css
index.html
According to the documentation here: https://docs.cloudfoundry.org/buildpacks/staticfile/index.html and this post, Push state enabled & context path routing: Static assets are not found on the server I should have the following Staticfile:
root: my_subdirectory
pushstate: enabled
location_include: includes/*.conf
and .conf
file:
location /my_subdirectory/ {
if (!-e $request_filename) {
rewrite ^(.*)$ /my_subdirectory/ break;
}
index.html;
}
but I still get the index.html file for every route, including the static files. Any guidance is appreciated. TIA.