# HG changeset patch # User Richard Westhaver # Date 1718217210 14400 # Node ID 9e1a84aa4ede4aa733d7562fc4a2e426c4082fad # Parent 05cbbcd63fa655f3845138684163d1a043e4aa72 update caddyfile diff -r 05cbbcd63fa6 -r 9e1a84aa4ede caddy/Caddyfile --- a/caddy/Caddyfile Wed Jun 12 14:31:33 2024 -0400 +++ b/caddy/Caddyfile Wed Jun 12 14:33:30 2024 -0400 @@ -9,32 +9,113 @@ # domain name. # # https://caddyserver.com/docs/caddyfile/concepts#addresses +{ + admin :2020 + email ellis@rwest.io + servers { + enable_full_duplex + } + order webdav before file_server +} -{ - # Restrict the admin interface to a local unix file socket whose directory - # is restricted to caddy:caddy. By default the TCP socket allows arbitrary - # modification for any process and user that has access to the local - # interface. If admin over TCP is turned on one should make sure - # implications are well understood. - admin "unix//run/caddy/admin.socket" +(logging) { + log { + output file /var/log/caddy.log + format json + } +} + +(cors-origin) { + @match-cors-preflight-{args.0} { + header Origin "{args.0}" + method OPTIONS + } + handle @match-cors-preflight-{args.0} { + header { + Access-Control-Allow-Origin "{args.0}" + Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" + Access-Control-Allow-Headers * + Access-Control-Max-Age "3600" + defer + } + respond "" 204 + } + + @match-cors-request-{args.0} { + header Origin "{args.0}" + not method OPTIONS + } + handle @match-cors-request-{args.0} { + header { + Access-Control-Allow-Origin "{http.request.header.origin}" + Access-Control-Expose-Headers * + defer + } + } } http:// { # Set this path to your site's directory. - root * /usr/share/caddy + root * /srv/http/ + file_server browse +} - # Enable the static file server. - file_server - # Another common task is to set up a reverse proxy: - # reverse_proxy localhost:8080 - - # Or serve a PHP site through php-fpm: - # php_fastcgi localhost:9000 - - # Refer to the directive documentation for more options. - # https://caddyserver.com/docs/caddyfile/directives +compiler.company { + import cors-origin https://cdn.compiler.company + root * /srv/http/compiler.company + handle { + try_files {path} {path.html} {path}/ + file_server + } +} +# chat.compiler.company +cdn.compiler.company { + @get method GET + import cors-origin * + import logging + root * /srv/http/cdn.compiler.company + route { + file_server @get browse + webdav + } } -# Import additional caddy config files in /etc/caddy/conf.d/ -import /etc/caddy/conf.d/* +the.compiler.company { + import cors-origin https://cdn.compiler.company + root * /srv/http/the.compiler.company + handle { + try_files {path}{path}.html {path}/ + file_server + } +} + +demo.compiler.company { + import cors-origin https://cdn.compiler.company + root * /srv/http/demo.compiler.company + # reverse_proxy +} + +packy.compiler.company { + @get method GET + import cors-origin https://packy.compiler.company + import logging + root * /srv/http/packy.compiler.company + route { + file_server @get browse + webdav + } +} + +hg.compiler.company { + import cors-origin https://packy.compiler.company + import cors-origin https://cdn.compiler.company + import cors-origin https://vc..compiler.company + import logging + root * /home/vc + reverse_proxy localhost:8888 +} +# nas-t.net +# otom8.dev +# rwest.io +# c2.rwest.io