{"action":"created","issue":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1036","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1036/labels{/name}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1036/comments","events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1036/events","html_url":"https://github.com/phoenixframework/phoenix/issues/1036","id":96057961,"number":1036,"title":"Splat route vs Plug.Static problem?","user":{"login":"tmjoen","id":10501945,"avatar_url":"https://avatars.githubusercontent.com/u/10501945?v=3","gravatar_id":"","url":"https://api.github.com/users/tmjoen","html_url":"https://github.com/tmjoen","followers_url":"https://api.github.com/users/tmjoen/followers","following_url":"https://api.github.com/users/tmjoen/following{/other_user}","gists_url":"https://api.github.com/users/tmjoen/gists{/gist_id}","starred_url":"https://api.github.com/users/tmjoen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmjoen/subscriptions","organizations_url":"https://api.github.com/users/tmjoen/orgs","repos_url":"https://api.github.com/users/tmjoen/repos","events_url":"https://api.github.com/users/tmjoen/events{/privacy}","received_events_url":"https://api.github.com/users/tmjoen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-20T12:56:58Z","updated_at":"2015-07-20T13:02:08Z","closed_at":null,"body":"In my app, I serve a `priv/media` directory through an additional `Plug.Static` in my endpoint.ex\r\n\r\n```elixir\r\n  plug Plug.Static,\r\n    at: \"/media\", from: \"priv/media\"\r\n```\r\n\r\nThis works fine.\r\n\r\nHowever, when I add a splat route like this:\r\n\r\n```elixir\r\n  # router.ex\r\n\r\n    get \"/:language/instagram\", Neva.InstagramController, :index\r\n    get \"/:language/*key\", Neva.PageController, :show\r\n```\r\n\r\nI start seeing some weird behaviour with my `/media` resources. Sometimes/randomly some of the images refuse to load, trying to go the splat route (PageController :show) instead of being handled by the `Plug.Static` for /media.\r\n\r\nWhen I right click the failed image, and try to reload it in a new tab - it works. The image is there, it just takes a wrong route trying to find it!\r\n\r\nIf I change the splat route so there are no chances of confusion:\r\n\r\n```elixir\r\n   # router.ex\r\n\r\n    get \"/n/:language/instagram\", Neva.InstagramController, :index\r\n    get \"/n/:language/*key\", Neva.PageController, :show\r\n```\r\n\r\nIt works fine again. Sometimes I don't see this bug for days, then suddenly it shows up all the time.\r\n\r\nI realize this is almost impossible to debug, but I thought I'd raise an issue here and see if anything jumped to your minds."},"comment":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments/122876792","html_url":"https://github.com/phoenixframework/phoenix/issues/1036#issuecomment-122876792","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1036","id":122876792,"user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T13:02:08Z","updated_at":"2015-07-20T13:02:08Z","body":"Btw, the description doesn't make much sense because defining a splat route does not change Plug.Static behaviour. Plug.Static is called very early on. What could be happening is just that we are being unable to find to find the static assets for some reason, maybe a file system issue, and that ends up invoking the splat route. They should not be related though."}}