I'm using akka-http for my React-based single page application's web server, and having issues where when I refresh my website. I get back a 404 for the requested resource (just index.html). Doing a "super refresh" (ctrl + refresh) works fine and everything loads as expected. But when I do a normal refresh, and the if-modified-since header is included in the request header, I noticed that the server gives back a 404 response.
~ {
getFromFile(s"$STATIC_CONTENT_ROOT/index.html")
}
To make sure this was actually the issue, I did a sanity check. I updated the code to update the modified date of all files in the resources folder (all the js files and the index.html) to be the current time whenever the catch-all / refresh endpoint was hit, and noticed that this fixed the refresh issue. However, the "solution" only works locally since I don't have write permissions on these resources once they're deployed to the actual dev or production shared hosts.
I'm now just looking for a solution that allows me to either ignore this part of the header or actually handle it properly. I've tried using the conditional(...) directive of akka-http but haven't had any luck.
Has anyone ever run into this issue before? And had success fixing this issue?