NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
23.19k stars 2.69k forks source link

I proxy my code-server through nginx-proxy-manager and got an error #2736

Closed snicoe closed 2 weeks ago

snicoe commented 1 year ago

my English is not good, please don't mind -_-lol I deployed the project on docker and successfully obtained the ssl certificate,the code-server is deployed on my homelab server. I proxy the code-server port through, when I access it with the domain, the code-server returns an error of "websocket 1006". By adding proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; establish websocket connection normally, I want to know the reason.

theraw commented 1 year ago

code-server requires websocket support so you have to enable it image

lauren12133 commented 1 year ago

image

image

image

useless!!!!

snicoe commented 1 year ago

code-server requires websocket support so you have to enable it image

websockets support is enabled,websocket 1006 is still reported, like @lauren12133

wbrione commented 1 year ago

Same stuff here !!! "Websockets Support" option has no effect all :-(

snicoe commented 1 year ago

@wbrione bro i solved this problem :) maybe help. Add “Custom Nginx Configuration", no other changes are needed.

location /
{
    proxy_pass http://[YOUR_SERVER_IP]:9901;
    proxy_set_header Host [YOUR_DOMAIN]:25052;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header   Upgrade          $http_upgrade;  
    proxy_set_header   Connection       "Upgrade";
    proxy_connect_timeout      60;   
    proxy_send_timeout         90;   
    proxy_read_timeout         90; 
    proxy_buffer_size          4k; 
    proxy_buffers              4 32k;
    proxy_busy_buffers_size    64k;  
    proxy_temp_file_write_size 64k;
    add_header X-Cache $upstream_cache_status;
}

change the [YOUR_SERVER_IP], [YOUR_DOMAIN] and server port to your own

wbrione commented 1 year ago

@snicoe

image

So, i created a "custom location", but... same error... in fact, some errors are still very specific, like...

Unable to open 'workspace'
Unable to resolve resource vscode-remote://<my domain>/config/workspace

or

ENOPRO: No file system provider found for resource 'vscode-remote:/config/data/User/settings.json'

So... back in your tip... I believe that plus change the [SERVER_IP] and [DOMAIN], i need replace the ports of two first lines, right ?!

Ports: 9901 and 25052... i don't recognize this :flushed:

snicoe commented 1 year ago

@wbrione yes ,you need replace the ports of two first lines

WannaYoung commented 1 year ago

@wbrione bro i solved this problem :) maybe help. Add “Custom Nginx Configuration", no other changes are needed.

location /
{
    proxy_pass http://[YOUR_SERVER_IP]:9901;
    proxy_set_header Host [YOUR_DOMAIN]:25052;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header   Upgrade          $http_upgrade;  
    proxy_set_header   Connection       "Upgrade";
    proxy_connect_timeout      60;   
    proxy_send_timeout         90;   
    proxy_read_timeout         90; 
    proxy_buffer_size          4k; 
    proxy_buffers              4 32k;
    proxy_busy_buffers_size    64k;  
    proxy_temp_file_write_size 64k;
    add_header X-Cache $upstream_cache_status;
}

change the [YOUR_SERVER_IP], [YOUR_DOMAIN] and server port to your own

You save my life!

github-actions[bot] commented 5 months ago

Issue is now considered stale. If you want to keep it open, please comment :+1: