1. Caddy version (caddy version
):
Caddy 2.0
2. How I run Caddy:
I run caddy in official Caddy Docker container
a. System environment:
Docker
d. My complete Caddyfile or JSON config:
dev.loft.test:80 {
root * /app/static
reverse_proxy /admin/* api:80
reverse_proxy /api/* api:80
file_server
}
3. The problem I’m having:
I have NGINX config and I need to convert it to Caddyfile. In example above I convert static part of site and django admin part. But api-path not working. What I do wrong & how to convert nginx.conf right?
upstream django {
server api:80;
}
server {
listen 80 default_server;
return 444;
}
server {
listen 80;
listen [::]:80;
server_name dev.loft.test;
client_max_body_size 4G;
keepalive_timeout 5;
location ~ ^/(api|admin)/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://django;
}
location / {
root /app/static;
index index.html;
try_files $uri $uri/ =404;
}
}