I’ve recently set up Nextcloud on my TrueNAS Scale system, and while it’s mostly working great, I’m having an issue opening any kind of office document. I set up my install at https://server.example.com/cloud/
, and when I try to open a document using the “Built in CODE” system, I get errors in the console that point to https://server.example.com/custom_apps/*
, missing the /cloud
prefix.
I’ve tried setting the WOPI allow list to 0.0.0.0/0
, and the server’s correct IP, but neither made any difference. “URL used by browser” is reported as https://server.example.com
, and “Nextcloud URL used by Collabora” is reported as https://server.example.com/cloud
.
Under Administration → Overview, the only issues reported are some old error logs that where left while I was setting things up.
I’m using Apache2 for my reverse proxy, and my config file is properly configured like so:
'overwritewebroot' => '/cloud',
'overwritehost' => 'server.example.com',
'overwriteprotocol' => 'https',
'overwritecondaddr' => '^256\.256\.256\.256$', // obviously replaced with my real server IP
'trusted_proxies' =>
array (
0 => '256.256.256.256', // obviously replaced with my real server IP
),
My SSL Apache is configured like so (I did strip out everything related to alternative apps, but this should be accurate to Nextcloud):
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName server.example.com
DocumentRoot /var/www/server.example.com/public_html
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/server.example.com/public_html>
Options FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
# Error and Access logging
LogLevel error
ErrorLog /var/log/apache2/server.example.com-error.log
CustomLog /var/log/apache2/server.example.com-access.log combined
# Set upgrade headers
Header set Connection "upgrade"
Header set Upgrade $http_upgrade
# Security and Performance Headers
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
Header set X-XSS-Protection "1; mode=block"
# Enable Proxy settings
ProxyPreserveHost On
ProxyRequests Off
# Redirect partial URLs to prevent unexpected 404s
RewriteEngine on
RewriteRule ^/cloud$ cloud/ [R=301,L]
# Proxy to Nextcloud instance
<Location /cloud/>
ProxyPass http://128.128.128.128/
ProxyPassReverse http://128.128.128.128/
RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/cloud/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/cloud/remote.php/dav/ [R=301,L]
</Location>
# Certificate settings
SSLCertificateFile /etc/letsencrypt/live/ssl-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ssl-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
# Handle HTTP2
Protocols h2 http/1.1
H2WindowSize 5242880
# Handle SSL
SSLEngine On
# Enable only strong encryption ciphers and prefer versions with Forward Secrecy
SSLCipherSuite HIGH:RC4-SHA:AES128-SHA:!aNULL:!MD5
SSLHonorCipherOrder on
# Disable insecure SSL and TLS versions
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
# Forward requests that came from TLS connections
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
# Enable HSTS
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
# Forward additional data for some apps (i.e. Nextcloud)
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}e
RequestHeader set X-Forwarded-Host %{HTTP_HOST}e
# Configure additional security settings
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 256.256.256.256
</VirtualHost>
</IfModule>