-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Reverse Proxy Issue #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your proxy pass needs to be |
giovanni is the hostname of the server in the network where the docker containers and services run, nginx itself is a docker container, so localhost wont work... |
To me it seems the issue is that you are trying to proxy Code-Server as a subfolder. AFAIK it has to run in root of the domain. |
So mywebsite.com/vscode would never work? |
No, at least not how it is currently designed. You would need to setup vscode.mywebsite.com. A lot of programs are designed this way today. With sni and free certs from let's encrypt this is also not much work. Only potential roadblock would be DNS providers not allowing additional DNS entries. |
I already use letsEncrypt, but I dont think I can setup a whole subdomain... |
At the moment (until #722 is merged), code-server doesn't work when it's not mounted at root ( You should be able to easily issue a new certificate for a subdomain on your domain through letsencrypt very easily, and then create a new virtual host in nginx. |
@deansheather I just created a subdomain and added configuration for proxy. But it gives me following error Nginx conf
Error |
@abubakar-bilal Add the following to your
|
Hey @deansheather Here is an issue, sub_filter is not working with above #770 (comment) proxy settings. People are saying that because you have gzip enabled therefore it's not working. And when I do this Code server starts giving me
Can you please guide me how can I achieve this. I want to use sub_filter on nginx level with proxy pass of code server. |
Hey!
this configuration (even with less proxy_set_header works fine). The reason i have them all is that my problem is that while the reverse proxy works fine, could it be that the forwarded headers gets ignored? |
@abubakar-bilal GH-826 should fix the @DarkIrata code-server doesn't have any mechanism to trust reverse proxies, nor is it needed since code-server doesn't do anything with remote IP addresses (except for logging them). If you'd like to log access to your code-server instance with nginx (or any other reverse proxy), I'd recommend using the access_log. |
Cannot wait to test this fix, as using substitution filters may allow users to add customized styles and fonts resources directly into the browser, potentially a hackaround for #760 . (Or let me know if there are more native ways for code-server to customized fonts etc.) |
@deansheather Thanks so much for this fix. I would like to hear how can I test this on my side. Because currently I download the release and running that on my machine. How can I test this PR to see if my issue fixed. @yihengli Yes if this works, then definitely custom styling issues will be fixed. Thanks so much for all the support provided by you guys. Really appreciate that. |
You can compile it by checking out my branch and running:
|
BTW, I did end up creating a PR with a |
ERROR BUILD:WEB failed {"exitCode":1,"stdout":"\n> @coder/web@ build /home/code-server/packages/web\n> ../../node_modules/.bin/cross-env UV_THREADPOOL_SIZE=100 node --max-old-space-size=32384 ../../node_modules/webpack/bin/webpack.js --config ./webpack.config.js\n\nHappy[ts]: Version: 5.0.1. Threads: 1\nHappy[ts]: All set; signaling webpack to proceed.\n","stderr":"npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1562586803937-0.6531972737635816/node but npm is using /usr/bin/node itself. Use the @deansheather I'm getting this error on second step. |
@deansheather Can you please let me know about this issue. How can I complete this setup. Because on mac it's working fine. and build is getting created. |
@abubakar-bilal Please post a link to the log file at the end of the error message as a gist. The log doesn't really tell me much except that it exited early. Make sure the node version installed is |
Here is the gist link attached of log file. |
Try again with node 10.15.1 and with the |
I updated node to 10.16.0 and again tried with scripts prepend added. Now that npm node warning went away. But still it gives error. Here is the gist of attached log file https://gist.github.com/abubakar-bilal/db47a5354e6e7c03abae04e401ee7b6c |
v2 has changed quite a bit surrounding all this so I'm uncertain how much if any still applies. I suppose for now I'll close this since it references v1 and if there are reverse proxy issues in v2 I'd love to hear them (either here or a new issue). |
@code-asher Having the same issue with v2 as well. I saw that you tried to do some patching for the same. Has it been pushed and is it working? |
It should be working; I do most of my testing through a reverse proxy.
If you're hosting at a subpath and using the login page then make sure
you've set the `--base-path` flag so code-server can redirect to
properly.
|
The flag is not in the latest release yet. I got the error below version info.
|
--base-path was removed, actually. code-server should work behind a base
path even without this flag.
|
code-server
version: v1.1156-vsc1.33.1Description
Reverse Proxy doesnt work at all.
It either results in failed SSL Handshake or
this:
Reverse Proxy Settings with working grafana above:
What am I missing?
The text was updated successfully, but these errors were encountered: