wking-io / elm-live

⚡ A flexible dev server for Elm. Live reload included.
https://elm-live.com
MIT License
1.05k stars 61 forks source link

reload code not served through nginx reverse proxy #274

Open nsadeh opened 1 year ago

nsadeh commented 1 year ago

Due to a complex backend inherited situation, I have an nginx setup through which I am trying to proxy to elm-live when I develop. Here is the nginx config:

location / {

            proxy_pass http://127.0.0.1:3000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;

            try_files /outage$uri /$tenant$uri $uri $uri/ =404;
        }

I run elm-live like this

elm-live src/Main.elm --port=3000 --pushstate -h 127.0.0.1 --dir=dist --verbose --hot -- --output=dist/app.js --debug

When I to to 127.0.0.1:3000 and make changes, hot reloading works. I can see that modified HTML pointing to the reload.js file in my sources. Note however that this is not a workaround, as this app cannot proxy to the backend so it doesn't do much.

When I go to my nginx endpoint (hostname.me:8080), I can see the app working, but hot-reloading doesn't work. When I go to the sources folder, I can see that the HTML file is modified to include reload.js, but the file doessn't itself seem to be served.

Why is that? Is there a way to fix it?