code-server (docker) and nuxt.js / javascript 404

346 Views Asked by At

Setup: I use a self-hosted code-server (dockerized) behind a fritzBox on my home lan. I have a FQDN (mysub.mydomain.com) pointing to a dyndns (mysdyn.my-router.com) with a cname entry which ends up on the fritzBox, port forwarded to the docker machine via a nginx reverse proxy with letsencrypt enabeld.

code-server works fine and is available via mysub.mydomain.com. With the live-server plugin works great@code-server and can be reached via mysub.mydomain.com/proxy/3000/ (3000 is an example port). Hot-reload and Javascript works.

Problem: working on a nuxt.js project (universal), when I run "yarn dev" the dev-server comes up normaly and the page can be reached via mysub.mydomain.com/proxy/3000/ and displays correct. But the "hot-reload" as well as all java scripts are not working because of a 404 for all .js-files.

The browser is looking for all .js-files under e.g. https://mysub.mydomain.com/_nuxt/runtime.js which correctly causes the 404, because coorect location would be https://mysub.mydomain.com/proxy/3000/_nuxt/runtime.js

What is causing this behavior and how can I fix this? I am even not sure where to start. Nginx or Nuxt? I already tried to play around with the router-setting in the config.nuxt.js - no luck.

thanks for your help!

1

There are 1 best solutions below

0
On

So, mysub.mydomain.com/proxy/3000/ is a hosted website behind an Nginx configuration?
If it's the case, you can't use yarn dev. This command is aimed towards a local development server.

You can't have HMR running on a hosted production app through some DNS, reverse proxy, port forwarding and so on. Or at least, this is what this is aimed towards.

Even having hot reload via code-server is kinda not mainstream. So yeah, you could maybe try some hacky things and achieve it, but you'll still end-up experiencing quite some bugs and the performance will probably be sub-par.
You don't want to stick to some local running apps?