{"action":"closed","issue":{"url":"https://api.github.com/repos/akka/akka-http/issues/1838","repository_url":"https://api.github.com/repos/akka/akka-http","labels_url":"https://api.github.com/repos/akka/akka-http/issues/1838/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka-http/issues/1838/comments","events_url":"https://api.github.com/repos/akka/akka-http/issues/1838/events","html_url":"https://github.com/akka/akka-http/issues/1838","id":294491639,"number":1838,"title":"getFromFile resulting in 404 when doing a refresh (w/ if-modified-since headers)","user":{"login":"minamesephy","id":4617408,"avatar_url":"https://avatars2.githubusercontent.com/u/4617408?v=4","gravatar_id":"","url":"https://api.github.com/users/minamesephy","html_url":"https://github.com/minamesephy","followers_url":"https://api.github.com/users/minamesephy/followers","following_url":"https://api.github.com/users/minamesephy/following{/other_user}","gists_url":"https://api.github.com/users/minamesephy/gists{/gist_id}","starred_url":"https://api.github.com/users/minamesephy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minamesephy/subscriptions","organizations_url":"https://api.github.com/users/minamesephy/orgs","repos_url":"https://api.github.com/users/minamesephy/repos","events_url":"https://api.github.com/users/minamesephy/events{/privacy}","received_events_url":"https://api.github.com/users/minamesephy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-05T18:16:16Z","updated_at":"2018-02-05T20:35:49Z","closed_at":"2018-02-05T20:35:49Z","author_association":"NONE","body":"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 getFromFile for index.html). \r\n```\r\n~ {\r\n  getFromFile(s\"$STATIC_CONTENT_ROOT/index.html\")\r\n}\r\n```\r\n\r\nDoing a \"super  refresh\" (ctrl + refresh) works fine and everything loads as expected.  But when I do a normal refresh, and the if-modified-since or if-none-match headers are included in the request headers, I noticed that the server gives back a  404 response. \r\n\r\nTo 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 wrapping the getFromFile($RESOURCES/index.html) w/ a condition(...) directive but haven't had any luck. \r\n\r\nAnother thing to note is that refreshing on other endpoints (endpoints that don't use getFromFile() work fine on refresh. So maybe it's something specific to getFromFile()? \r\n\r\nUpdate: I just did some more digging and found the directive code for getFromFile():\r\nhttps://github.com/akka/akka-http/blob/master/akka-http/src/main/scala/akka/http/scaladsl/server/directives/FileAndResourceDirectives.scala#L58-L78\r\nI looks like it does take into account the modifiedDate and the tag, so wrapping it wouldn't have helped. \r\n\r\nIt looks like I need to use the akka.http.routing.file-get-conditional setting, but I'm not sure where to set this. Looking into it...\r\n"}}
{"actor":{"display_login":"minamesephy"}}