Sub-path reverse-proxying with Coder
From @STRONG.CODΞ in https://discord.com/channels/747933592273027093/971231372373033030/1239657571099607100
---
Hey,
im having a little trouble with the network configs. Im hosting code-server in docker and didnt change much except the passwords and config location. The only problem I have now is that if im hosting lets say a page with expressJS and im using a seperate css and js file which are located in /public i cant access them because:
1. [port].sub.domain.com cant be accessed so I need to use sub.domain.com/proxy/[port].
2. When using sub.domain.com/proxy/3000 its trying to get the css file from sub.domain.com/proxy/style.css which is not a file.
I hope you are able to understand my problem nd may be able to help me.
Thank you in advance.
10 Replies
<#1240138607126380625>
Category
Help needed
Product
code-server
Platform
Linux
Logs
Please post any relevant logs/error messages.
basically you have to configure your app's base URL to be /proxy/<port> or to dynamically detect what base URL it's being accessed from
OS: Linux/Ubuntu
subpath reverse-proxying can cause issues like this, this isn't necessarily a code-server thing
just added that but you can select the OS yourself in the dropdown by the way!
Doesn’t work
I tried three times. It times out
you should see this thread on the Caddy forum which explains the problem well, now we're not using Caddy but it's the same issue
https://caddy.community/t/the-subfolder-problem-or-why-cant-i-reverse-proxy-my-app-into-a-subfolder/8575
sorry, just corrected the path
Thank you. I’ll try it now
My proxy is currently pointing to the ip:8443 should it be ip:8443/proxy?
Hey @Phorcys you got a sec? I tried fixing the problem but I dont quite understand what exactly I have to do.
I know the problem is inside of the reverse proxy config / im missing something in the config but I cant figure out what exactly.
I also looked into this: https://caddy.community/t/alias-directive-like-in-nginx/15258/2 because my reverse proxy is running on nginx but I dont get it because I need it variable and not for every single port…
Would be very nice if you could help me out with that.
I did managed to get it running by adjusting my firewall but still dont see the css and js when using /proxy/<port>. I dont really need it anymore but would be nice to have it running and a solution for other people 😄
Thank you
Caddy Community
Alias directive like in NGINX?
I moved your comment into a new topic, because it was unrelated to the wiki topic you commented on – the article was specifically about proxying to apps whose code you don’t control. That said, I’m not really sure what you’re asking here. Isn’t your Caddy config equivalent? All alias does in nginx is define an alternative root for the file serv...
oh no, in this case the reverse-proxy is code-server
well, your app is being reverse-proxied by code-server which is being reverse-proxied by nginx
since you can't tune code-server to do any of this, at least not AFAIK, you need to do modifications to your app
the Caddy thread I sent just explains what's happening
I understand, thank you