1. My Caddy version (caddy version
): v1
2. How I run Caddy:
Laradock - caddy
a. System environment:
Ubuntu 18.04 sv
b. Command:
docker-compose up -d caddy
c. Service/unit/compose file:
Dockerfile
FROM abiosoft/caddy:no-stats
CMD ["--conf", "/etc/caddy/Caddyfile", "--log", "stdout", "--agree=true"]
EXPOSE 80 443 2015
d. My complete Caddyfile or JSON config:
# Docs: https://caddyserver.com/docs/caddyfile
domain.test:443 {
root /var/www/public
fastcgi / php-fpm:9000 php {
index index.php
}
# To handle .html extensions with laravel change ext to
# ext / .html
rewrite {
to {path} {path}/ /index.php?{query}
}
gzip
browse
log /var/log/caddy/access.log
errors /var/log/caddy/error.log
# Uncomment to enable TLS (HTTPS)
# Change the first list to listen on port 443 when enabling TLS
tls self_signed
# To use Lets encrpt tls with a DNS provider uncomment these
# lines and change the provider as required
#tls {
# dns cloudflare
#}
}
admin.codeky.test:443{
root /var/www/admin/dist
ext / .html
rewrite {
to {path} /
}
gzip
browse
log /var/log/caddy/access.log
errors /var/log/caddy/error.log
tls self_signed
proxy /api https://domain.test {
transparent
}
}
3. The problem I’m having:
I cannot send a request to https://domain.test via proxy.
4. Error messages and/or full log output:
I am using ant design pro, the proposed nginx configuration
server {
listen 80;
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
root /usr/share/nginx/html;
location / {
# 用于配合 browserHistory使用
try_files $uri $uri/ /index.html;
# 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验
# rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent;
}
location /api {
proxy_pass https://ant-design-pro.netlify.com;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
# 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验
listen 443 ssl http2 default_server;
# 证书的公私钥
ssl_certificate /path/to/public.crt;
ssl_certificate_key /path/to/private.key;
location / {
# 用于配合 browserHistory使用
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass https://ant-design-pro.netlify.com;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
I tried many ways to turn to caddy, but without success