1. Caddy version (caddy version
):
2.0.0
2. How I run Caddy:
Kubernetes (K3S)
a. System environment:
K3S on Ubuntu
b. Command:
caddy run --config=/etc/caddy/Caddyfile.json
c. Service/unit/compose file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: reverse-proxy
namespace: default
labels:
app: reverse-proxy
tier: proxy
spec:
replicas: 2
revisionHistoryLimit: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
selector:
matchLabels:
app: reverse-proxy
tier: proxy
template:
metadata:
labels:
app: reverse-proxy
tier: proxy
spec:
volumes:
- name: caddy-data
persistentVolumeClaim:
claimName: caddy
- name: caddy-config
configMap:
name: caddy-config
containers:
- name: caddy
image: caddy:2.0.0
imagePullPolicy: Always
command: ["caddy", "run"]
args:
- --config=/etc/caddy/Caddyfile.json
volumeMounts:
- name: caddy-data
mountPath: /data
- name: caddy-config
mountPath: /etc/caddy/Caddyfile.json
subPath: Caddyfile.json
resources:
requests:
memory: "100Mi"
cpu: "60m"
limits:
memory: "150Mi"
cpu: "90m"
livenessProbe:
tcpSocket:
port: caddy
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
tcpSocket:
port: caddy
initialDelaySeconds: 15
periodSeconds: 20
ports:
- containerPort: 80
name: caddy
- containerPort: 443
name: caddy-secure
d. My complete Caddyfile or JSON config:
{
"apps": {
"http": {
"servers": {
"srv0": {
"automatic_https": {
"disable": true
},
"listen": [
":80"
],
"routes": [
{
"match": [
{
"host": [
"caddy.myserver.io"
]
}
],
"handle": [
{
"handler": "reverse_proxy",
"transport": {
"http": {
"protocol": "http",
"tls": {}
}
},
"upstreams": [
{
"dial": "icanhazip.com:443"
}
]
}
],
"terminal": false
}
]
}
}
}
}
}
3. The problem I’m having:
I’m trying to set a transport to reverse proxy an HTTP → HTTPS request. The transport says I’m missing a protocol? Which I have.
If I remove the transport I get an error on the end server that I’m speaking HTTP to an HTTPS server. If I remove the transport and talk HTTP it works.
4. Error messages and/or full log output:
run: loading initial config: loading new config: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'reverse_proxy': provision http.handlers.reverse_proxy: loading transport: module name not specified with key 'protocol' in map[http:map[protocol:http tls:map[]]]
5. What I already tried:
Verified that HTTP reverse proxying works without any issue. Tried seeing if the protocol
needed to be something like “https” instead of "http.