Vite Subdomain proxy with HMR #4541
-
I'm just getting started with code-server. I've been trying to set up a Sveltekit project - based on Vite. I'm having some trouble seeing the dev server. I access code-server through Cloudflare Argo Tunnel, using Nginx Proxy Manager for a reverse proxy. I've been able to get the My primary issues:
Is it currently possible to address these with a Vite project and code-server? I'm also just starting to explore Cloudflare so it wouldn't surprise me if the Argo Tunnel is a factor here. Even if these don't get solved, very impressed with the work on code-server! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 11 replies
-
I wish I had more experience with Nginx to help here. What I can offer is trying this out on a very simple setup (code-server running via homebrew on macOS). If you post repo steps (assume I have code-server installed) for setting up a Sveltekit and what you expect for the HMR, then I can try it myself locally! Then if that works, we could rule out code-server being the issue and troubleshoot looking into the rest of your stack |
Beta Was this translation helpful? Give feedback.
-
Additional info I've uncovered as I continue to work on this issue: Subdomain proxy absproxy
It's important to note the trailing slash is required to get to the However, I still haven't been able to get HMR working. I've been tinkering with the
I believe the I think the next hurdle is correctly loading the file at Recording these thoughts in case anyone else comes along and as some insight based on my current state. |
Beta Was this translation helpful? Give feedback.
-
In case anyone comes across this later trying to solve the same issue, here's what I know: 1. Subdomain proxy 2. Base path Specifically addressing the trailing slash I mentioned here, this is also a bug in SvelteKit and is listed in their issue queue. In short, neither of these things are issues with code-server. |
Beta Was this translation helpful? Give feedback.
-
Following up here, @bpmct helped me get HMR reloading working in code-server by having me edit my export default defineConfig({
base: "/proxy/3000",
server: {
hmr: {
clientPort: 8080,
},
},
}); And then accessing it via http://localhost:8080/proxy/3000/proxy/3000/ |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a simple example of a ViteJS project with React, using code-server? I got some problem to configure the proxy with vitejs. No problem with CRA |
Beta Was this translation helpful? Give feedback.
In case anyone comes across this later trying to solve the same issue, here's what I know:
1. Subdomain proxy
Subdomain proxy will not work with the Cloudflare free tier on it's own (for my setup) - the SSL certificate provided by Cloudflare only covers subdomains, not sub-subdomains (e.g. 3000.codeserver..)
2. Base path
This is actually an issue with SvelteKit specifically. The base path doesn't apply to the dev server files correctly. I've opened an issue in that repo to address it:
sveltejs/kit#2958
Specifically addressing the trailing slash I mentioned here, this is also a bug in SvelteKit and is listed in their issue queue.
In short, neither of these things are issues with code-server.