WebSocket connection failed

Nextcloud version 29.0.4
Operating system and version Ubuntu 24.04
Apache 2.4.58
PHP version 8.3

The issue you are facing:
when i open doc file via onlyoffice i see this error in console
WebSocket connection to ‘wss://office.mysite.com/8.1.1-26/doc/1221858245/c/?shardkey=1221858245&EIO=4&transport=websocket’ failed:
WebSocket connection to ‘wss://office.mysite.com.id/8.1.1-26/doc/1221858245/c/?shardkey=1221858245&EIO=4&transport=websocket&sid=V9X0Rz3BntQRyxZpAABA’ failed:

You are using wss:// (with SSL) and not ws:// (without SSL). Perhaps you have not configured SSL anywhere on your web server, Nextcloud or Collabora Online. Also note that your client must have access to the URL. Also make sure that you are using correct SSL certificates.

both have a ssl certificate made through certbot

my onlyoffice config

config

<VirtualHost *:80>
ServerName office.mysite .com
Redirect permanent / https://office.mysite .com/

<VirtualHost *:443>
ServerName office.mysite .com
ServerAlias www.office.mysite .com
ServerAdmin webmaster@yourdomain .com

DocumentRoot /var/www/onlyoffice
UseCanonicalName Off

ErrorLog ${APACHE_LOG_DIR}/onlyoffice_error.log
CustomLog ${APACHE_LOG_DIR}/onlyoffice_access.log .combined

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/office.mysite .com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/office.mysite .com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/office.mysite .com/chain.pem
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

SetEnvIf Host "^(.*)$" THE_HOST=$1
RequestHeader setifempty X-Forwarded-Proto https
RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
ProxyAddHeaders Off

ProxyPassMatch ^/doc/([a-zA-Z0-9\-\./_]+)/websocket ws://127.0.0.1:7512/doc/$1/websocket
ProxyPassReverse ^/doc/([a-zA-Z0-9\-\./_]+)/websocket ws://127.0.0.1:7512/doc/$1/websocket

ProxyPass / http://127.0.0.1:7512/
ProxyPassReverse / http://127.0.0.1:7512/

<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>

I put extra spaces in the links so I could leave this message.

maybe it’s the problem?

Thank you for responding so quickly, I didn’t expect that kind of response