1. Caddy version (caddy version
):
2.4.1
2. How I run Caddy:
a. System environment:
Debian 10.0
b. Command:
As per install docs
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
c. Service/unit/compose file:
Paste full file contents here.
Make sure backticks stay on their own lines,
and the post looks nice in the preview pane.
d. My complete Caddyfile or JSON config:
preview.minty.art {
header User-Agent *bot* {
reverse_proxy * localhost:9009
}
header User-Agent *Bot* {
reverse_proxy * localhost:9009
}
header User-Agent *Python* {
reverse_proxy * localhost:9009
}
root * /var/www
file_server
log {
output file /var/log/preview.log
}
}
3. The problem Iām having:
The App is a react app, hence og
tags cannot be created,
I am trying to figure out how to redirect bots to use a reverse proxy so that I can generate previews
I need to check the āUser-Agentā header and given anything with ābotā or āBotā or āPythonā send it to a reverse proxy insteadā¦
(this is on a demo server without the react app - I have figured out how to get the react app working
using try_files {path} /index.html
4. Error messages and/or full log output:
run: adapting config using caddyfile: parsing caddyfile tokens for āheaderā: /etc/caddy/Caddyfile:12 - Error during parsing: cannot specify headers in both arguments and block
5. What I already tried:
All the examples about redirecting bots seem to be old (Caddy 1.x) so it isnāt really clear where to start hereā¦