Skip to content

Instantly share code, notes, and snippets.

@zaidakram
Last active April 12, 2022 13:24
Show Gist options
  • Select an option

  • Save zaidakram/3c38bed309bc6e2675b9b85d688e0073 to your computer and use it in GitHub Desktop.

Select an option

Save zaidakram/3c38bed309bc6e2675b9b85d688e0073 to your computer and use it in GitHub Desktop.
[Caddy V1] Need to port this from V1 to V2 without breaking anything.
gzip
tls support@app.com
errors /var/log/caddy/error.log {
rotate_size 10
rotate_keep 10
rotate_compress
}
log / /var/log/caddy/access.log "{combined} {hostonly} {latency_ms}" {
rotate_size 10
rotate_keep 10
rotate_compress
}
app.com api.app.com docs.app.com admin.app.com business.app.com {
gzip
root /home/user/app.com/current/public
rewrite {
if {path} is /
to /app-proxy/{uri}
}
rewrite {
to index.html {path} /app-proxy/{uri}
}
proxy /app-proxy unix:/home/user/app.com/shared/tmp/sockets/puma.sock {
without /app-proxy
transparent
}
}
:443 {
import Caddycommon
gzip
root /home/user/app.com/current/public
tls {
# on-demand
ask https://api.app.com/path/present.json
}
rewrite {
if {path} is /
to /app-proxy/{uri}
}
rewrite {
to index.html {path} /app-proxy/{uri}
}
proxy /app-proxy unix:/home/user/app.com/shared/tmp/sockets/puma.sock {
without /app-proxy
transparent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment