<IfModule mod_ssl.c>
 <VirtualHost *:443>
 ServerName coll.f7cloud.ru
 AllowEncodedSlashes NoDecode
 ProxyPreserveHost On


 # static html, js, images, etc. served from coolwsd
 # browser is the client part of Collabora Online
 ProxyPass           /browser http://127.0.0.1:9980/browser retry=0
 ProxyPassReverse    /browser http://127.0.0.1:9980/browser

<Location "/browser/">
    Header unset Cache-Control
    Header unset Expires
    Header unset ETag
    Header always set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header always set Pragma "no-cache"
    Header always set Expires "0"
    ExpiresActive On
    ExpiresDefault "now"
    FileETag None

    # Критично: не сжимать повторно
    SetEnv no-gzip 1
    SetEnv no-brotli 1
    # На время отладки можно вообще попросить backend не присылать gzip/br:
    # RequestHeader unset Accept-Encoding
</Location>

Alias "/f7cloud-loading-preview" "/usr/share/coolwsd/browser/dist/f7cloud"
<Directory "/usr/share/coolwsd/browser/dist/f7cloud">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted
    DirectoryIndex loading-preview.html
</Directory>

<Location "/loleaflet/">
    Header unset Cache-Control
    Header unset Expires
    Header unset ETag
    Header always set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header always set Pragma "no-cache"
    Header always set Expires "0"
    ExpiresActive On
    ExpiresDefault "now"
    FileETag None

    SetEnv no-gzip 1
    SetEnv no-brotli 1
    # RequestHeader unset Accept-Encoding   # (включи, если снова увидишь Content-Length: 0)
</Location>


 # WOPI discovery URL
 ProxyPass           /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
 ProxyPassReverse    /hosting/discovery http://127.0.0.1:9980/hosting/discovery


 # Capabilities
 ProxyPass           /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
 ProxyPassReverse    /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities


 # Main websocket
 ProxyPassMatch      "/cool/(.*)/ws$"      ws://127.0.0.1:9980/cool/$1/ws nocanon


 # Admin Console websocket
 ProxyPass           /cool/adminws ws://127.0.0.1:9980/cool/adminws


 # Download as, Fullscreen presentation and Image upload operations
 ProxyPass           /cool http://127.0.0.1:9980/cool
 ProxyPassReverse    /cool http://127.0.0.1:9980/cool
 # Compatibility with integrations that use the /lool/convert-to endpoint
 ProxyPass           /lool http://127.0.0.1:9980/cool
 ProxyPassReverse    /lool http://127.0.0.1:9980/cool
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

# RewriteCond %{SERVER_NAME} =coll.f7cloud.ru
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

SSLCertificateFile /etc/letsencrypt/live/coll.f7cloud.ru/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/coll.f7cloud.ru/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
