Closed eamlinux closed 2 years ago
caddy version:
v2.5.0 h1:eRHzZ4l3X6Ag3kUt8nj5IxATprhqKq/wToP7OHlXWA0=
caddy list-modules:
Standard modules: 95 admin.api.trojan caddy.listeners.trojan http.handlers.trojan trojan trojan.proxies.env_proxy trojan.proxies.no_proxy trojan.upstreams.caddy trojan.upstreams.memory Non-standard modules: 8 Unknown modules: 0
以下兩配置trojan均無法使用:
trojan
{ order trojan before map admin off log { output discard } servers :443 { listener_wrappers { trojan } protocol { allow_h2c experimental_http3 } } trojan { caddy no_proxy users password1 password2 } } :443, xx.yy { encode { gzip 6 } tls { protocols tls1.3 curves x25519 alpn h2 } @host { host xx.yy } route @host { trojan { connect_method websocket } header { Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" X-Content-Type-Options nosniff X-Frame-Options SAMEORIGIN Referrer-Policy no-referrer-when-downgrade } file_server { root /var/www/html } } }
{ "admin": {"disabled": true}, "logging": { "logs": { "default": { "writer": {"output":"discard"} } } }, "apps": { "http": { "servers": { "srv0": { "listen": [":443"], "listener_wrappers": [{"wrapper": "trojan"}], "routes": [{ "handle": [{ "encodings": {"gzip": {"level": 6}}, "handler": "encode", "prefer": ["gzip"] }] }, { "handle": [{ "handler": "trojan", "connect_method": false, "websocket": false }] }, { "match": [{"host": ["xx.yy"]}], "handle": [{ "handler": "subroute", "routes": [{ "handle": [{ "handler": "headers", "response": { "set": { "Referrer-Policy": ["no-referrer-when-downgrade"], "Strict-Transport-Security": ["max-age=31536000; includeSubDomains; preload"], "X-Content-Type-Options": ["nosniff"], "X-Frame-Options": ["SAMEORIGIN"] } } }] }, { "handle": [{ "handler": "file_server", "root": "/var/www/html" }] }] }] }], "tls_connection_policies": [{ "curves": ["x25519"], "alpn": ["h2"], "protocol_min": "tls1.3" }], "experimental_http3": true, "allow_h2c": true } } }, "trojan": { "upstream": { "upstream": "caddy" }, "proxy": { "proxy": "no_proxy" }, "users": ["password1", "password2"] }, "tls": { "certificates": { "automate": ["xx.yy"] } } } }
我的也是,错误信息: {"level":"error","ts":1651072062.8276677,"logger":"caddy.listeners.trojan","msg":"read prefix error: read tcp 114.250.230.xxx:17711 -> 104.194.247.xxx:443: read: EOF"}
Fixed
caddy version:
caddy list-modules:
配置1:
配置2: