Skip to content
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

nginx 反向代理以后,通过域名访问创建项目报错 #164

Closed
qixin1991 opened this issue Apr 10, 2017 · 1 comment

Comments

Projects
4 participants
@qixin1991
Copy link

commented Apr 10, 2017

WebIDE 跑在 Docker里面:

docker run --name webide-coding -p 9090:8080 -v $PWD/.coding-ide-home:/home/coding/.coding-ide-home -d webide/webide

直接使用IP没有问题

Nginx配置

server {
    listen 443 ssl http2;
    server_name 马赛克域名;

    ssl_certificate /etc/letsencrypt/live/马赛克域名/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/马赛克域名/privkey.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_prefer_server_ciphers on;
    ssl_stapling on;

    root /var/www/html;

    location / {
         proxy_headers_hash_max_size 51200;
         proxy_headers_hash_bucket_size 6400;
         proxy_set_header Host  $host;
         proxy_set_header X-Forwarded-For $remote_addr;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_pass http://172.20.9.1:9090;
    }
}

域名访问服务,创建workspace会一直卡在 95%那不动,使用内网IP http://172.20.9.1:9090访问可以正常创建服务。在IP方式服务创建成功后,使用域名方式访问,打开项目也会报错:

图片

图片

图片

@qixin1991 qixin1991 changed the title 域名访问与主题修改 域名访问-创建不了项目 Apr 10, 2017

@vangie vangie changed the title 域名访问-创建不了项目 nginx 反向代理以后,通过域名访问创建项目报错 Apr 10, 2017

@vangie vangie added this to the v0.12.0 milestone May 2, 2017

@hackape hackape added this to todo in M 0.12.0 May 3, 2017

@tanhe123

This comment has been minimized.

Copy link
Collaborator

commented May 4, 2017

这是一个 CORS 问题,chrome 在请求时,即使是同源,也会发送 Origin 头,所以这就导致了问题。
这个已经提交了 pr 修复了,参见 Coding/WebIDE-Backend#19

另外使用你的 nginx 配置还需要加上这样的配置,来让 websocket 有效:

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

@tanhe123 tanhe123 moved this from todo to to-test in M 0.12.0 May 4, 2017

@hackape hackape closed this May 5, 2017

@hackape hackape moved this from to-test to done in M 0.12.0 May 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.