gromdron / bitrix-push-workspace

Локальный websocket сервер для Битрикс24
3 stars 1 forks source link

ошибка #1

Open dev-bitrix opened 3 months ago

dev-bitrix commented 3 months ago

приветствую, хотел использовать вашу наработку по веб сокету, но, проблема. Настроил вроде все корректно, но, при GET запросе на /bitrix/sub/ 404 ошибку отдает с браузера. При попытке запроса по wss также с браузера вижу ошибку NS_ERROR_WEBSOCKER_CONNECTION_REFUSED и статус заблокирован. С контейнера с nginx пингуется контейнер с Push

в Nginx использую такой шаблон

`server { listen 80; server_name #SITE_NAME#;

charset utf-8;
root /var/www/bitrix;
index index.php index.html bitrixsetup.php restore.php;

access_log /var/log/nginx/#SITE_NAME#-access.log;
error_log /var/log/nginx/#SITE_NAME#-error.log;

# bitrix recommendation, respect server's mime-type and don't try to guess it
add_header X-Content-Type-Options nosniff;

location ~* ^/bitrix/subws/ {
    proxy_pass http://push-upstream;
    # http://blog.martinfjordvald.com/2013/02/websockets-in-nginx/
    # 12h+0.5
    proxy_max_temp_file_size 0;
    proxy_read_timeout  43800;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $replace_upgrade;
    proxy_set_header Connection $connection_upgrade;
}

location ~* ^/bitrix/sub/ {
    rewrite ^/bitrix/sub/(.*)$ /bitrix/subws/$1 break;
    proxy_pass http://push-upstream;
    proxy_max_temp_file_size 0;
    proxy_read_timeout  43800;
}

location ~* ^/bitrix/rest/ {
    proxy_pass http://push-upstream;
    proxy_max_temp_file_size 0;
    proxy_read_timeout  43800;
}

if (!-e $request_filename) {
   rewrite  ^(.*)$  /bitrix/urlrewrite.php last;
}

# remove multiple slashes
# duplicated slashes sometimes will work and won't be rewritten, fixing it in this configuration is tricky
rewrite ^([^.]*?\/)\/+(.*)$ $1$2 permanent;

# redirect index.php to page without it
if ($request_uri ~* "^(.*/)index\.php$") {
    return 301 $1;
}

location / {
    if (-f /var/www/bitrix/index.php) {
        root /var/www/bitrix;
        break;
    }
    if (-f /var/www/bitrix/bitrixsetup.php) {
        root /var/www/bitrix;
        break;
    }
    if (-f /var/www/bitrix/restore.php) {
        root /var/www/bitrix;
        break;
    }
    try_files $uri $uri/ @bitrix;
    root  /var/www/bitrix;
}

location /.well-known {
    root /var/www/bitrix;
}

location @bitrix {
    fastcgi_pass php-upstream;
    include fastcgi_params;
    # make SERVER_NAME behave same as HTTP_HOST
    fastcgi_param SERVER_NAME $host;
    fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
}

location = /restore.php {
    include fastcgi_params;
    fastcgi_pass php-upstream;
    fastcgi_index index.php;
    fastcgi_send_timeout 21600;
    fastcgi_read_timeout 21600;
    # make SERVER_NAME behave same as HTTP_HOST
    fastcgi_param SERVER_NAME $host;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    client_body_buffer_size 1024m;
    client_max_body_size 1024m;
}

location = /favicon.png {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    log_not_found off;
    access_log off;
}

location ~ (/\.ht|/\.git|/\.gitignore|/vendor/|/composer|/bitrix/updates|/bitrix/modules|/upload/support/not_image|/upload/1c_exchange|/bitrix/php_interface|/logs/) {
    deny all;
}

location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|eot|otf|ttf|woff|woff2)$ {
    log_not_found off;
    access_log off;
    expires 30d;
    add_header Cache-Control public;
    # re-add security header
    add_header X-Content-Type-Options nosniff;
}

location ~ /upload/ {
    client_body_buffer_size 1024m;
    client_max_body_size 1024m;
}

location ~ \.php$ {
    if (!-f $request_filename) {
      rewrite  ^(.*)/index.php$  $1/ redirect;
    }
    include fastcgi_params;
    fastcgi_pass php-upstream;
    fastcgi_index index.php;
    fastcgi_send_timeout 21600;
    fastcgi_read_timeout 21600;
    # make SERVER_NAME behave same as HTTP_HOST
    fastcgi_param SERVER_NAME $host;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

error_page 404 /404.html;

location /404.html {}

}`

сертификат от LE генерирую. В этом же конфе потом вместо 80 станет автоматом 443.

image

в docker-compose.yml так стоит у меня

image

image

можете подсказать пожалуйста, в тупике...

dev-bitrix commented 3 months ago

в nginx.conf добавил как в вашем описании image

gromdron commented 3 months ago

ПО пока не умеет работать с HTTPS (WSS) соединениями, оно поддерживает только HTTP. На локальных разработках я не использую сертифкаты, поэтому не готовил ПО к такой работе.