Skip to content

Instantly share code, notes, and snippets.

@a-s-o
Last active January 6, 2021 10:28
Show Gist options
  • Save a-s-o/8419a5c94bc689c9b6823e8883b534a7 to your computer and use it in GitHub Desktop.
Save a-s-o/8419a5c94bc689c9b6823e8883b534a7 to your computer and use it in GitHub Desktop.
Single page app rewriting with Caddy server
localhost:80
gzip
ext .html
root /home/deploy/current/build/www
proxy /graphql localhost:3000
rewrite /login {
to {path} /login
}
rewrite /app {
to {path} /
}
errors {
log caddy_error.log {
size 50 # Rotate after 50 MB
age 30 # Keep rotated files for 30 days
keep 5 # Keep at most 5 log files
}
404 404.html # Not Found
500 500.html # Internal Server Error
}
@RecuencoJones
Copy link

Hey Michael, this Caddyfile syntax belongs to Caddy v1. Caddy v2 has a bit different syntax, you can check it here: https://caddyserver.com/docs/caddyfile/directives/rewrite

@TimoA200
Copy link

Hey Michael, this Caddyfile syntax belongs to Caddy v1. Caddy v2 has a bit different syntax, you can check it here: https://caddyserver.com/docs/caddyfile/directives/rewrite

Hey RecuencoJones, can you please give me an example of the new Caddy v2 syntax for vue. I've tried so much but I just can't get it to work.

@RecuencoJones
Copy link

@TimoA200
Copy link

Thank you! It is easier than I thought

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment