反向代理并修改网页内cdn链接 via Caddy

目的

反向代理某服务,并替换网页内cdn链接为其他可访问的url

安装

安装Caddy时添加http.filter插件
相关文档

配置Caddyfile

https://mysite.com {
    filter rule {
        content_type text/html.*
        search_pattern cdn.miansite.com
        replacement cdn.mysite.com
    }

    proxy / https://miansite.com {
        header_downstream -Content-Security-Policy
        header_downstream -Strict-Transport-Security
        header_downstream -Public-Key-Pins
        header_downstream -X-XSS-Protection
    }
    gzip
    tls [email protected]
}

https://cdn.mysite.com {
    proxy / cdn.miansite.com {
        header_downstream -Content-Security-Policy
        header_downstream -Strict-Transport-Security
        header_downstream -Public-Key-Pins
        header_downstream -X-XSS-Protection
    }
    gzip
    tls [email protected]
}


以上

Comments
Write a Comment