mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-28 03:24:43 +00:00
fix(bentopdf): serve libreoffice wasm gz with correct nginx headers
Fix Word/Excel conversion hang by serving /libreoffice-wasm assets with proper MIME types and Content-Encoding. - serve soffice.wasm.gz as application/wasm + Content-Encoding: gzip - serve soffice.data.gz as octet-stream + Content-Encoding: gzip - add immutable caching for wasm/data assets - always refresh nginx site+service during update to migrate existing installs - switch install script dependency handling to ensure_dependencies nginx
This commit is contained in:
+33
-8
@@ -54,9 +54,8 @@ function update_script() {
|
|||||||
msg_ok "Updated BentoPDF"
|
msg_ok "Updated BentoPDF"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
if ! command -v nginx &>/dev/null; then
|
ensure_dependencies nginx
|
||||||
ensure_dependencies nginx
|
cat <<'EOF' >/etc/nginx/sites-available/bentopdf
|
||||||
cat <<'EOF' >/etc/nginx/sites-available/bentopdf
|
|
||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 8080;
|
||||||
server_name _;
|
server_name _;
|
||||||
@@ -72,6 +71,33 @@ server {
|
|||||||
|
|
||||||
gzip_static on;
|
gzip_static on;
|
||||||
|
|
||||||
|
location ~* /libreoffice-wasm/soffice\.wasm\.gz$ {
|
||||||
|
gzip off;
|
||||||
|
types {} default_type application/wasm;
|
||||||
|
add_header Content-Encoding gzip;
|
||||||
|
add_header Vary "Accept-Encoding";
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* /libreoffice-wasm/soffice\.data\.gz$ {
|
||||||
|
gzip off;
|
||||||
|
types {} default_type application/octet-stream;
|
||||||
|
add_header Content-Encoding gzip;
|
||||||
|
add_header Vary "Accept-Encoding";
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.wasm$ {
|
||||||
|
types {} default_type application/wasm;
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(wasm\.gz|data\.gz|data)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ $uri.html =404;
|
try_files $uri $uri/ $uri.html =404;
|
||||||
}
|
}
|
||||||
@@ -79,9 +105,9 @@ server {
|
|||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
rm -f /etc/nginx/sites-enabled/default
|
||||||
ln -sf /etc/nginx/sites-available/bentopdf /etc/nginx/sites-enabled/bentopdf
|
ln -sf /etc/nginx/sites-available/bentopdf /etc/nginx/sites-enabled/bentopdf
|
||||||
cat <<'EOF' >/etc/systemd/system/bentopdf.service
|
cat <<'EOF' >/etc/systemd/system/bentopdf.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BentoPDF Service
|
Description=BentoPDF Service
|
||||||
After=network.target
|
After=network.target
|
||||||
@@ -95,8 +121,7 @@ Restart=always
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
|
||||||
systemctl start bentopdf
|
systemctl start bentopdf
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install nginx -y
|
$STD apt install nginx -y
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
@@ -48,6 +47,33 @@ server {
|
|||||||
|
|
||||||
gzip_static on;
|
gzip_static on;
|
||||||
|
|
||||||
|
location ~* /libreoffice-wasm/soffice\.wasm\.gz$ {
|
||||||
|
gzip off;
|
||||||
|
types {} default_type application/wasm;
|
||||||
|
add_header Content-Encoding gzip;
|
||||||
|
add_header Vary "Accept-Encoding";
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* /libreoffice-wasm/soffice\.data\.gz$ {
|
||||||
|
gzip off;
|
||||||
|
types {} default_type application/octet-stream;
|
||||||
|
add_header Content-Encoding gzip;
|
||||||
|
add_header Vary "Accept-Encoding";
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.wasm$ {
|
||||||
|
types {} default_type application/wasm;
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(wasm\.gz|data\.gz|data)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ $uri.html =404;
|
try_files $uri $uri/ $uri.html =404;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user