1. Caddy version (caddy version
):
v2.3
2. How I run Caddy:
caddy run --config=caddy.json
a. System environment:
Ubuntu 20.04
b. Command:
Paste command here.
caddy run --config=caddy.json
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:
{
"apps": {
"http": {
"servers": {
"example": {
"listen": [":80",":443"],
"routes": [
{
"match": [{"host": ["example.com"]}],
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{"dial":"xxx.xxx.xxx.xxx:5000"}]
}]
}
]
}
}
}
}
}
Paste config here, replacing this text.
Use `caddy fmt` to make it readable.
DO NOT REDACT anything except credentials.
LEAVE DOMAIN NAMES INTACT.
Make sure the backticks stay on their own lines.
3. The problem I’m having:
I want to redirect http://example.com to https://example.com. Because it is not working by default.
So for achieving this, i was thinking of using redir directive but didn’t find any example of using redir in json format file.
Please assist where should I put redir directive to redirect http://example.com → https://example.com