bournerj
Phoenix server is delivering default HTML instead of requested JS files
Hi all
I’m pretty new to Elixir/Phoenix so hopefully this isn’t a noob mistake…
I am currently seeing an issue with (I think) the cache manifest whereby my site delivers HTML and CSS files properly but for JS files, the default HTML template is being delivered - which results in an error like:
Refused to execute script from 'http://example.com:4000/js/MyApp.prod.app.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Server console is showing:
[debug] Processing with Mag.PageController.index/2
Parameters: %{"path" => ["js", "MyApp.prod.app.js"]}
Pipelines: [:browser]
[info] Sent 200 in 245µs
Which suggests it thinks it has delivered the file - is that correct?
I can see in the Chrome Dev Tools Network tab that the response from this request is the app.html.eex file.
I have confirmed that the file listed as the current version in cache_manifest.json does exist on the server - the CSS files are (seemingly) being delivered in the same way and work fine.
The project was built on OSX, which is where the original phx.digest command was run. I am trying to use it on CentOS - I’m not deploying a full package, merely re-running phx.server on the CentOS box. I also tried running phx.digest on the CentOS box to no avail.
This may not impact anything but I’m running Phoenix inside a Docker container on the CentOS box.
Any help greatly appreciated and please let me know if I can provide any additional information.
Most Liked
bournerj
@joaoevangelista thanks for the suggestion - sent me off down the path of serving static files and came across this thread Static files not found where the OP was referencing files which didn’t actually exist.
My issue was that in app.html.eex I was using MYApp.prod.app.js yet the actual file being produced was MyApp.prod.app.js. OSX is more forgiving than CentOS when it comes to such things.
@NobbZ thanks for your help as well ![]()
Sorry for wasting time! Hopefully this helps someone else in the same scenario, though - even if the filenames seem correct, double, no triple check!
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









