2012-11-09 16:30:07 +04:00
|
|
|
<IfModule mod_headers.c>
|
2015-08-11 11:55:57 +03:00
|
|
|
<IfModule mod_setenvif.c>
|
|
|
|
<IfModule mod_fcgid.c>
|
2015-03-26 17:30:00 +03:00
|
|
|
SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
|
|
|
|
RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
|
|
|
|
</IfModule>
|
2015-08-11 11:55:57 +03:00
|
|
|
<IfModule mod_proxy_fcgi.c>
|
|
|
|
SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
|
|
|
|
</IfModule>
|
2021-04-16 11:05:02 +03:00
|
|
|
<IfModule mod_lsapi.c>
|
|
|
|
SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
|
|
|
|
RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
|
|
|
|
</IfModule>
|
2015-03-26 17:30:00 +03:00
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
<IfModule mod_env.c>
|
|
|
|
# Add security and privacy related headers
|
2020-01-19 18:53:08 +03:00
|
|
|
# Avoid doubled headers by unsetting headers in "onsuccess" table,
|
|
|
|
# then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
|
2024-11-29 13:54:36 +03:00
|
|
|
|
|
|
|
<If "%{REQUEST_URI} =~ m#/login$#">
|
|
|
|
# Only on the login page we need any Origin or Referer header set.
|
|
|
|
Header onsuccess unset Referrer-Policy
|
|
|
|
Header always set Referrer-Policy "same-origin"
|
|
|
|
</If>
|
|
|
|
<Else>
|
|
|
|
Header onsuccess unset Referrer-Policy
|
|
|
|
Header always set Referrer-Policy "no-referrer"
|
|
|
|
</Else>
|
2020-01-19 18:53:08 +03:00
|
|
|
|
|
|
|
Header onsuccess unset X-Content-Type-Options
|
2019-07-01 19:41:59 +03:00
|
|
|
Header always set X-Content-Type-Options "nosniff"
|
2020-01-19 18:53:08 +03:00
|
|
|
|
|
|
|
Header onsuccess unset X-Frame-Options
|
2019-07-01 19:41:59 +03:00
|
|
|
Header always set X-Frame-Options "SAMEORIGIN"
|
2020-01-19 18:53:08 +03:00
|
|
|
|
|
|
|
Header onsuccess unset X-Permitted-Cross-Domain-Policies
|
2019-07-01 19:41:59 +03:00
|
|
|
Header always set X-Permitted-Cross-Domain-Policies "none"
|
2020-01-19 18:53:08 +03:00
|
|
|
|
|
|
|
Header onsuccess unset X-Robots-Tag
|
2023-02-13 16:09:13 +03:00
|
|
|
Header always set X-Robots-Tag "noindex, nofollow"
|
2020-01-19 18:53:08 +03:00
|
|
|
|
|
|
|
Header onsuccess unset X-XSS-Protection
|
2019-07-01 19:41:59 +03:00
|
|
|
Header always set X-XSS-Protection "1; mode=block"
|
2020-01-19 18:53:08 +03:00
|
|
|
|
2015-03-26 17:30:00 +03:00
|
|
|
SetEnv modHeadersAvailable true
|
|
|
|
</IfModule>
|
|
|
|
|
2016-08-08 18:39:53 +03:00
|
|
|
# Add cache control for static resources
|
2024-07-15 19:06:13 +03:00
|
|
|
<FilesMatch "\.(css|js|mjs|svg|gif|png|jpg|webp|ico|wasm|tflite)$">
|
2023-03-02 20:38:04 +03:00
|
|
|
<If "%{QUERY_STRING} =~ /(^|&)v=/">
|
|
|
|
Header set Cache-Control "max-age=15778463, immutable"
|
|
|
|
</If>
|
|
|
|
<Else>
|
|
|
|
Header set Cache-Control "max-age=15778463"
|
|
|
|
</Else>
|
2022-02-12 00:14:04 +03:00
|
|
|
</FilesMatch>
|
|
|
|
|
2024-09-16 10:58:54 +03:00
|
|
|
# Let browsers cache OTF and WOFF files for a week
|
|
|
|
<FilesMatch "\.(otf|woff2?)$">
|
2016-11-11 15:10:35 +03:00
|
|
|
Header set Cache-Control "max-age=604800"
|
2015-03-26 17:30:00 +03:00
|
|
|
</FilesMatch>
|
2012-11-09 16:30:07 +04:00
|
|
|
</IfModule>
|
2021-04-16 11:05:02 +03:00
|
|
|
|
2021-04-21 11:11:06 +03:00
|
|
|
<IfModule mod_php.c>
|
2021-04-16 11:05:02 +03:00
|
|
|
php_value mbstring.func_overload 0
|
|
|
|
php_value default_charset 'UTF-8'
|
|
|
|
php_value output_buffering 0
|
|
|
|
<IfModule mod_env.c>
|
|
|
|
SetEnv htaccessWorking true
|
|
|
|
</IfModule>
|
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
<IfModule mod_mime.c>
|
|
|
|
AddType image/svg+xml svg svgz
|
2021-11-17 14:30:12 +03:00
|
|
|
AddType application/wasm wasm
|
2021-04-16 11:05:02 +03:00
|
|
|
AddEncoding gzip svgz
|
2023-03-16 17:57:51 +03:00
|
|
|
# Serve ESM javascript files (.mjs) with correct mime type
|
|
|
|
AddType text/javascript js mjs
|
2021-04-16 11:05:02 +03:00
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
<IfModule mod_dir.c>
|
|
|
|
DirectoryIndex index.php index.html
|
|
|
|
</IfModule>
|
|
|
|
|
|
|
|
<IfModule pagespeed_module>
|
|
|
|
ModPagespeed Off
|
|
|
|
</IfModule>
|
|
|
|
|
2012-01-03 07:55:19 +04:00
|
|
|
<IfModule mod_rewrite.c>
|
2015-08-16 16:40:03 +03:00
|
|
|
RewriteEngine on
|
2019-07-01 19:45:27 +03:00
|
|
|
RewriteCond %{HTTP_USER_AGENT} DavClnt
|
|
|
|
RewriteRule ^$ /remote.php/webdav/ [L,R=302]
|
2015-08-16 16:40:03 +03:00
|
|
|
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
2015-11-18 19:40:27 +03:00
|
|
|
RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
|
|
|
|
RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
|
2015-08-16 16:40:03 +03:00
|
|
|
RewriteRule ^remote/(.*) remote.php [QSA,L]
|
2016-06-03 17:34:26 +03:00
|
|
|
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
|
2020-12-28 17:36:23 +03:00
|
|
|
RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
|
2023-10-10 00:17:12 +03:00
|
|
|
RewriteRule ^ocm-provider/?$ index.php [QSA,L]
|
2020-12-28 17:36:23 +03:00
|
|
|
RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
|
2012-01-03 07:55:19 +04:00
|
|
|
</IfModule>
|
2021-04-16 11:05:02 +03:00
|
|
|
|
2024-01-23 13:01:58 +03:00
|
|
|
# Clients like xDavv5 on Android, or Cyberduck, use chunked requests.
|
|
|
|
# When FastCGI or FPM is used with apache, requests arrive to Nextcloud without any content.
|
|
|
|
# This leads to the creation of empty files.
|
|
|
|
# The following directive will force the problematic requests to be buffered before being forwarded to Nextcloud.
|
|
|
|
# This way, the "Transfer-Encoding" header is removed, the "Content-Length" header is set, and the request content is proxied to Nextcloud.
|
|
|
|
# Here are more information about the issue:
|
|
|
|
# - https://docs.cyberduck.io/mountainduck/issues/fastcgi/
|
|
|
|
# - https://docs.nextcloud.com/server/latest/admin_manual/issues/general_troubleshooting.html#troubleshooting-webdav
|
2024-04-25 17:29:38 +03:00
|
|
|
<IfModule mod_setenvif.c>
|
2024-11-27 10:38:29 +03:00
|
|
|
SetEnvIfNoCase Transfer-Encoding "chunked" proxy-sendcl=1
|
2024-01-23 13:01:58 +03:00
|
|
|
</IfModule>
|
|
|
|
|
2024-09-16 10:58:54 +03:00
|
|
|
# Apache disabled the sending of the server-side content-length header
|
2024-08-29 10:52:08 +03:00
|
|
|
# in their 2.4.59 patch updated which breaks some use-cases in Nextcloud.
|
|
|
|
# Setting ap_trust_cgilike_cl allows to bring back the usual behaviour.
|
|
|
|
# See https://bz.apache.org/bugzilla/show_bug.cgi?id=68973
|
|
|
|
<IfModule mod_env.c>
|
|
|
|
SetEnv ap_trust_cgilike_cl
|
|
|
|
</IfModule>
|
|
|
|
|
2013-02-26 20:38:59 +04:00
|
|
|
AddDefaultCharset utf-8
|
2012-05-11 12:47:42 +04:00
|
|
|
Options -Indexes
|