You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
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.
At the moment (until #722 is merged), code-server doesn't work when it's not mounted at root (/) in your reverse proxy.
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.
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 proxy_set_header Accept-Encoding "";
Code server starts giving me Not Found and console inspect says this
Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-jKkgppGJ08cqS5XKPdlf/Mdph8lsIR979iy7r3fw7Mw='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
A bad HTTP response code (404) was received when fetching the script.
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.
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?
In the code-server log i only see the IP from the nginx server (10.0.2.2). INFO WebSocket opened / {"client":5,"ip":"10.0.2.2"}
@abubakar-bilalGH-826 should fix the Accept-Encoding issue you have and allow you to use substitution filters in your reverse proxy.
@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.
@abubakar-bilalGH-826 should fix the Accept-Encoding issue you have and allow you to use substitution filters in your reverse proxy.
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.
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 --scripts-prepend-node-path option to include the path for the node binary npm was executed with.\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! @coder/web@ build: ../../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\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the @coder/web@ build script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /root/.npm/_logs/2019-07-08T11_57_42_562Z-debug.log\n"}
@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 10.15.1, and the node version yarn is using is the same one (apparently yarn is using a different instance of node). Try running the yarn commands with --scripts-prepend-node-path.
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).
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.
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.
Activity
giantcow commentedon Jun 13, 2019
Your proxy pass needs to be
http://localhost:8443nothttp://giovanni:8443I believe. I'm not sure where you gotgiovannifrom.AmansRevenger commentedon Jun 14, 2019
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...
fbartels commentedon Jun 14, 2019
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.
AmansRevenger commentedon Jun 14, 2019
So mywebsite.com/vscode would never work?
fbartels commentedon Jun 14, 2019
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.
AmansRevenger commentedon Jun 14, 2019
I already use letsEncrypt, but I dont think I can setup a whole subdomain...
deansheather commentedon Jun 15, 2019
At the moment (until #722 is merged), code-server doesn't work when it's not mounted at root (
/) in your reverse proxy.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.
abubakar-bilal commentedon Jun 27, 2019
@deansheather I just created a subdomain and added configuration for proxy. But it gives me following error
Nginx conf
Error
WebSocket connection to 'wss://ide.mysite.com/' failed: Error during WebSocket handshake: Unexpected response code: 200https://ide.mysite.com
deansheather commentedon Jun 27, 2019
@abubakar-bilal Add the following to your
locationblock:abubakar-bilal commentedon Jul 2, 2019
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
proxy_set_header Accept-Encoding "";Code server starts giving me
Not Foundand console inspect says thisCan you please guide me how can I achieve this. I want to use sub_filter on nginx level with proxy pass of code server.
DarkIrata commentedon Jul 4, 2019
Hey!
Having a running server behind a reverse proxy through nginx.
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?
In the code-server log i only see the IP from the nginx server (10.0.2.2).
INFO WebSocket opened / {"client":5,"ip":"10.0.2.2"}deansheather commentedon Jul 7, 2019
@abubakar-bilal GH-826 should fix the
Accept-Encodingissue you have and allow you to use substitution filters in your reverse proxy.@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.
yihengli commentedon Jul 7, 2019
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.)
abubakar-bilal commentedon Jul 8, 2019
@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.
deansheather commentedon Jul 8, 2019
You can compile it by checking out my branch and running:
deansheather commentedon Jul 8, 2019
BTW, I did end up creating a PR with a
--trust-proxyarg: GH-835.abubakar-bilal commentedon Jul 8, 2019
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
--scripts-prepend-node-pathoption to include the path for the node binary npm was executed with.\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! @coder/web@ build:../../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\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the @coder/web@ build script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /root/.npm/_logs/2019-07-08T11_57_42_562Z-debug.log\n"}@deansheather I'm getting this error on second step.
abubakar-bilal commentedon Jul 10, 2019
@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.
deansheather commentedon Jul 11, 2019
@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
10.15.1, and the node version yarn is using is the same one (apparently yarn is using a different instance of node). Try running the yarn commands with--scripts-prepend-node-path.abubakar-bilal commentedon Jul 11, 2019
Here is the gist link attached of log file.
https://gist.github.com/abubakar-bilal/15e415d5388f0540e198bec1ac8d638e
deansheather commentedon Jul 11, 2019
Try again with node 10.15.1 and with the
--scripts-prepend-node-pathon the yarn commands.abubakar-bilal commentedon Jul 11, 2019
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
code-asher commentedon Nov 1, 2019
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).
datsabk commentedon Jan 13, 2020
@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?
code-asher commentedon Jan 13, 2020
jiayiliu commentedon Aug 19, 2021
The flag is not in the latest release yet. I got the error below
error Unknown option --base-path=/vscode
version info.
code-server 3.11.1 c680aae
code-asher commentedon Aug 23, 2021