Skip to content

Instantly share code, notes, and snippets.

@mdusher
Created April 11, 2016 00:48
Show Gist options
  • Save mdusher/8d1d4f6917b855ded8fd6422ef693c81 to your computer and use it in GitHub Desktop.
Save mdusher/8d1d4f6917b855ded8fd6422ef693c81 to your computer and use it in GitHub Desktop.
Caddyfile for Owncloud (work-in-progress)
cloud.usher.is {
tls [email protected]
root /owncloud
errors {
403 /core/templates/403.php
404 /core/templates/404.php
}
fastcgi / 127.0.0.1:9000 php {
env HTTP_AUTHORIZATION {>Authorization}
env PATH_INFO {path}
}
header / {
X-Content-Type-Options "nosniff"
X-XSS-Protection "1; mode=block"
X-Robots-Tag "none"
X-Frame-Options "SAMEORIGIN"
X-Download-Options "noopen"
X-Permitted-Cross-Domain-Policies "none"
}
# Add cache control for css and js files
rewrite {
ext .js .css
header / Cache-Control "max-age=7200,public"
}
# Rewrite rules for `front_controller_active`
rewrite {
if {path} is /core/js/oc.js
to index.php/core/js/oc.js
}
rewrite {
if {path} is /core/preview.png
to index.php/core/preview.png
}
redir {
/.well-known/host-meta /public.php?service=host-metai&{query}
/.well-known/host-meta.json /public.php?service=host-meta-json&{query}
/remote/ remote.php?{query}
}
redir 301 {
/.well-known/carddav /remote.php/dav/
/.well-knonw/caldav /remote.php/dav/
}
rewrite {
if {path} starts_with /build/
if {path} starts_with /tests/
if {path} starts_with /config/
if {path} starts_with /lib/
if {path} starts_with /3rdparty/
if {path} starts_with /templates/
if {path} starts_with .
if {path} starts_with autotest
if {path} starts_with occ
if {path} starts_with issue
if {path} starts_with indie
if {path} starts_with db_
if {path} starts_with console
status 404
}
rewrite {
if {path} ends_with .css
if {path} ends_with .js
if {path} ends_with .svg
if {path} ends_with .gif
if {path} ends_with .png
if {path} ends_with .html
if {path} ends_with .ttf
if {path} ends_with .woff
if {path} ends_with .ico
if {path} starts_with /.well-known/acme-challenge/
if {path} not /remote.php
if {path} not /public.php
if {path} not /cron.php
if {path} not /core/ajax/update.php
if {path} not /status.php
if {path} not /ocs/v1.php
if {path} not /ocs/v2.php
if {path} not /updater/
if {path} not /ocs-provider/
to index.php
}
mime {
.svg image/svg+xml
.svgz image/svg+xml
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment