Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http.matchers does not work in caddy-l4 #29

Closed
PaTTeeL opened this issue Sep 8, 2021 · 1 comment
Closed

http.matchers does not work in caddy-l4 #29

PaTTeeL opened this issue Sep 8, 2021 · 1 comment

Comments

@PaTTeeL
Copy link

PaTTeeL commented Sep 8, 2021

I'm going to reverse proxies HTTP to backend with proxy protocol for websocket with special path, but it seems http.matchers in caddy-l4 does not work even I just write one http match, here is my configuration:
Caddyfile.json

{
  "admin":{"disabled":true},
  "logging": {"logs": {
    "default":{
      "level":"DEBUG","encoder":{"format":"json"},
      "writer":{"filename":"/tmp/caddy.log","output":"file"},
      "exclude":["http.log.access.log0","http.log.access.log1"]},
    "log0":{
      "level":"DEBUG","encoder":{"format":"json"},
      "writer":{"filename":"/tmp/http.log","output":"file"},
      "include":["http.log.access.log0","http.log.access.log1"]}}},
  "apps": {
    "layer4":{"servers":{
      "stream0":{
        "listen":[":443"],
        "routes":[
          {
            "handle":[{"handler":"tls"},{"handler":"proxy","upstreams":[{"dial":["127.0.0.1:8001"]}],"proxy_protocol":"v2"}],
            "match":[
              { 
                "http":[
                  { 
                    "header":{
                      "Upgrade":["websocket"]
                    }
                  }
                ]
              }
            ]
          },
          { 
            "handle":[{"handler":"tls"},{"handler":"proxy","upstreams":[{"dial":["127.0.0.1:8002"]}],"proxy_protocol":"v2"}],
            "match":[
              { 
                "http":[
                  { 
                    "path":["/8002"]
                  }
                ]
              }
            ]
          },
          { "handle":[{"handler":"tls"},{"handler":"proxy","upstreams":[{"dial":["127.0.0.1:8000"]}],"proxy_protocol":"v2"}]}
        ]
      }
    }},
    "http": {"servers": {
      "http0":{
        "listen":[":80"],
        "logs":{"default_logger_name":"log0"},
        "routes":[{"handle":[{
          "handler":"static_response","headers":{"Location":["https://{http.request.host}{http.request.uri}"]},"status_code":301}]}]
      },
      "http1": {
        "allow_h2c":true,
        "listen":["127.0.0.1:8000"],
        "listener_wrappers":[{"wrapper":"proxy_protocol"}],
        "logs":{"default_logger_name":"log1"},
        "routes": [
          { "handle": [{
              "handler": "headers",
              "response": {"set": {
                "Strict-Transport-Security": ["max-age=31536000; includeSubDomains; preload"],
                "X-Content-Type-Options": ["nosniff"],
                "X-Frame-Options": ["SAMEORIGIN"],
                "X-Robots-Tag": ["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"]}}}]},
          { "handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:8003"}]}],
            "match":[{"header":{"Upgrade":["websocket"]},"path":["/8003"]}]},
          { "handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"127.0.0.1:8004"}]}],
            "match":[{"header":{"Upgrade":["websocket"]},"path":["/8004"]}]},
          { "handle": [{"handler": "file_server","hide": ["/etc/caddy/Caddyfile.json"],"root": "/var/home"}]}
        ],
        "errors": {"routes": [
          { "handle": [{"handler": "rewrite","uri": "/index.html"}]},
          { "handle": [{"handler": "file_server","hide": ["/etc/caddy/Caddyfile.json"],"root": "/var/home"}]}
        ]}
      }
    }},
    "tls":{
      "certificates":{"automate":["domain.com"]},
      "automation":{"policies":[{"issuers":[{"module":"zerossl"}]}]}
    }
  }
}

caddy.log here:

{"level":"warn","ts":1631097143.2176166,"logger":"admin","msg":"admin endpoint disabled"}
{"level":"info","ts":1631097143.2184045,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"http0","http_port":80}
{"level":"info","ts":1631097143.2245347,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000393030"}
{"level":"debug","ts":1631097143.2974496,"logger":"layer4","msg":"listening","address":"tcp/[::]:443"}
{"level":"debug","ts":1631097143.3084638,"logger":"tls.cache","msg":"added certificate to cache","subjects":["mydomain.com"],"expiration":1638662399,"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097143.3085592,"logger":"http","msg":"starting server loop","address":"[::]:80","http3":false,"tls":false}
{"level":"debug","ts":1631097143.3086965,"logger":"http","msg":"starting server loop","address":"127.0.0.1:8000","http3":false,"tls":false}
{"level":"info","ts":1631097143.3086019,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
{"level":"info","ts":1631097143.3092394,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"info","ts":1631097143.3093457,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
{"level":"info","ts":1631097143.3116603,"msg":"serving initial configuration"}
{"level":"info","ts":1631097143.3117192,"logger":"watcher","msg":"watching config file for changes","config_file":"/etc/caddy/Caddyfile.json"}
{"level":"debug","ts":1631097427.6923897,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097427.6924815,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097427.6924927,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097427.8528264,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:30464","server_name":"mydomain.com"}
{"level":"debug","ts":1631097427.8530192,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:30464","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097427.853516,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097427.8536227,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:30464","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Upgrade":["websocket"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Worker":["cf.workers.dev"],"Connection":["Upgrade"],"Accept-Encoding":["gzip"],"X-Forwarded-Proto":["https"],"Cf-Connecting-Ip":["IPIP"],"X-Forwarded-For":["IPIP"],"Cf-Ray":["68b78a29579eebd5-LAX"],"Sec-Websocket-Key":["go4E7uifiXyQGsqbXISc8w=="],"Sec-Websocket-Version":["13"],"Cf-Ew-Via":["15"],"Cdn-Loop":["cloudflare; subreqs=1"],"User-Agent":["Go-http-client/1.1"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097427.8536372,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097427.8536615,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097496.7244058,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097496.7245393,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097496.7245498,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097497.1746256,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:51993","server_name":"mydomain.com"}
{"level":"debug","ts":1631097497.1747851,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:51993","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097497.1765633,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8001","result":"/var/home/8001"}
{"level":"debug","ts":1631097497.176639,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:51993","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["websocket.key"],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097497.1766522,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097497.1766653,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097497.5578418,"logger":"layer4","msg":"connection stats","remote":"IPIP:51993","read":594,"written":10899,"duration":0.834689686}
{"level":"debug","ts":1631097498.0101454,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097498.0102103,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097498.0102196,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097498.4510102,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:51994","server_name":"mydomain.com"}
{"level":"debug","ts":1631097498.4511786,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:51994","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097498.4514956,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8001","result":"/var/home/8001"}
{"level":"debug","ts":1631097498.4515553,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:51994","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["websocket.key"],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097498.4515758,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097498.451593,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097498.8536725,"logger":"layer4","msg":"connection stats","remote":"IPIP:51994","read":594,"written":10898,"duration":0.845920969}
{"level":"debug","ts":1631097499.993334,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097499.99341,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097499.99342,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097500.4150765,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:51996","server_name":"mydomain.com"}
{"level":"debug","ts":1631097500.4152358,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:51996","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097500.42214,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8001","result":"/var/home/8001"}
{"level":"debug","ts":1631097500.422234,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:51996","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["kfmeD0dquEhvaEy1m7aemw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097500.4222484,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097500.4222617,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097500.8077915,"logger":"layer4","msg":"connection stats","remote":"IPIP:51996","read":594,"written":10899,"duration":0.816859118}
{"level":"debug","ts":1631097501.7454286,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097501.7455046,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097501.7455142,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097502.1724303,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:51998","server_name":"mydomain.com"}
{"level":"debug","ts":1631097502.1726205,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:51998","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097502.1735847,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8001","result":"/var/home/8001"}
{"level":"debug","ts":1631097502.1736438,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:51998","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["+c3aYixUa0vkLlk9uQjvpA=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097502.1736562,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097502.1736805,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097502.5579233,"logger":"layer4","msg":"connection stats","remote":"IPIP:51998","read":594,"written":10899,"duration":0.813359319}
{"level":"debug","ts":1631097503.5637326,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097503.5637982,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097503.5638072,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097503.9857993,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52000","server_name":"mydomain.com"}
{"level":"debug","ts":1631097503.985975,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52000","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097503.986999,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8001","result":"/var/home/8001"}
{"level":"debug","ts":1631097503.9870715,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52000","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["zG//cFwo7T/aWeonWGSunw=="]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097503.9870846,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097503.9870977,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097504.3665636,"logger":"layer4","msg":"connection stats","remote":"IPIP:52000","read":594,"written":10899,"duration":0.809525412}
{"level":"debug","ts":1631097509.3183365,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097509.3184264,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097509.3184366,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097509.7621365,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52006","server_name":"mydomain.com"}
{"level":"debug","ts":1631097509.7623522,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52006","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097509.7633018,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097509.7633681,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52006","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["NhGjlsHMA838N3IUhstn2A=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097509.7633922,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097509.7634058,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097510.1364229,"logger":"layer4","msg":"connection stats","remote":"IPIP:52006","read":594,"written":10900,"duration":0.825733884}
{"level":"debug","ts":1631097510.5461917,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097510.5462697,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097510.5462794,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097510.9690325,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52007","server_name":"mydomain.com"}
{"level":"debug","ts":1631097510.969252,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52007","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097510.9702334,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097510.970295,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52007","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["5j++1JTZbNd/nDnUR1Rh/w=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097510.9703076,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097510.9703207,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097511.2072554,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097511.2073295,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097511.2073395,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097511.353876,"logger":"layer4","msg":"connection stats","remote":"IPIP:52007","read":594,"written":10900,"duration":0.814580101}
{"level":"debug","ts":1631097511.3665795,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:37004","server_name":"mydomain.com"}
{"level":"debug","ts":1631097511.366737,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:37004","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097511.367178,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097511.3672657,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:37004","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Version":["13"],"Cf-Connecting-Ip":["IPIP"],"Cf-Worker":["cf.workers.dev"],"Accept-Encoding":["gzip"],"X-Forwarded-For":["IPIP"],"Cf-Ray":["68b78c3382f6eb41-LAX"],"X-Forwarded-Proto":["https"],"Connection":["Upgrade"],"Sec-Websocket-Key":["2soWKtUR1wZITQvbXmLfpQ=="],"Cf-Ew-Via":["15"],"Cdn-Loop":["cloudflare; subreqs=1"],"Upgrade":["websocket"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"User-Agent":["Go-http-client/1.1"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097511.3673146,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097511.3673325,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097512.3475347,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097512.347602,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097512.3476114,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097512.7838993,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52015","server_name":"mydomain.com"}
{"level":"debug","ts":1631097512.784145,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52015","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097512.7851133,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097512.7851973,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52015","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Key":["qpb+rkDSXTYfjAmisOUt6g=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097512.7852116,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097512.7852252,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097512.8735797,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097512.873662,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097512.8736732,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097513.0358064,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:39534","server_name":"mydomain.com"}
{"level":"debug","ts":1631097513.0360348,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:39534","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097513.0364077,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097513.0365279,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:39534","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"X-Forwarded-For":["IPIP"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Websocket-Key":["Bqxw7rNH9YZLO8Jis87Kdw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"Cf-Ew-Via":["15"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Cf-Ray":["68b78c3de60c368c-LAX"],"Cdn-Loop":["cloudflare; subreqs=1"],"Cf-Worker":["cf.workers.dev"],"Accept-Encoding":["gzip"],"X-Forwarded-Proto":["https"],"Cf-Connecting-Ip":["IPIP"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097513.036576,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097513.0365932,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097513.1738474,"logger":"layer4","msg":"connection stats","remote":"IPIP:52015","read":594,"written":10898,"duration":0.830936741}
{"level":"debug","ts":1631097514.001975,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097514.0021365,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097514.002149,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097514.4457097,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52019","server_name":"mydomain.com"}
{"level":"debug","ts":1631097514.445968,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52019","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097514.4477167,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097514.447783,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52019","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Connection":["Upgrade"],"Sec-Websocket-Key":["6bN+kohY7NXKXn7camr0UA=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097514.4477954,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097514.4478087,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097514.8454726,"logger":"layer4","msg":"connection stats","remote":"IPIP:52019","read":594,"written":10900,"duration":0.850479567}
{"level":"debug","ts":1631097515.4172804,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097515.4173877,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097515.4174001,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097515.5749407,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:42954","server_name":"mydomain.com"}
{"level":"debug","ts":1631097515.5751567,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:42954","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097515.5756023,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097515.5756893,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:42954","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Connection":["Upgrade"],"Cf-Ray":["68b78c4de7660cdf-LAX"],"Sec-Websocket-Version":["13"],"Cf-Ew-Via":["15"],"Accept-Encoding":["gzip"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Websocket-Key":["dNUNBjJFHEYkFHVTDYq/rQ=="],"Upgrade":["websocket"],"X-Forwarded-For":["IPIP"],"Cdn-Loop":["cloudflare; subreqs=1"],"X-Forwarded-Proto":["https"],"User-Agent":["Go-http-client/1.1"],"Cf-Connecting-Ip":["IPIP"],"Cf-Worker":["cf.workers.dev"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097515.5757039,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097515.5757434,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097515.8476615,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097515.8477476,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097515.8477583,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097516.2760677,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52025","server_name":"mydomain.com"}
{"level":"debug","ts":1631097516.27627,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52025","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097516.2771955,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/8002","result":"/var/home/8002"}
{"level":"debug","ts":1631097516.2773259,"logger":"http.handlers.rewrite","msg":"rewrote request","request":{"remote_addr":"IPIP:52025","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["5r7xARBahO4LJCEuiC5hNw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"method":"GET","uri":"/index.html"}
{"level":"debug","ts":1631097516.2773411,"logger":"http.handlers.file_server","msg":"sanitized path join","site_root":"/var/home","request_path":"/index.html","result":"/var/home/index.html"}
{"level":"debug","ts":1631097516.277355,"logger":"http.handlers.file_server","msg":"opening file","filename":"/var/home/index.html"}
{"level":"debug","ts":1631097516.6638021,"logger":"layer4","msg":"connection stats","remote":"IPIP:52025","read":594,"written":10899,"duration":0.823057503}
{"level":"debug","ts":1631097520.512052,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097520.5121393,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097520.5121615,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097520.9416094,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52032","server_name":"mydomain.com"}
{"level":"debug","ts":1631097520.9418695,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52032","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097520.942889,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"127.0.0.1:8003","request":{"remote_addr":"IPIP:52032","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8003","headers":{"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"],"Sec-Websocket-Key":["websocket.key"]}},"headers":{"Upgrade":["websocket"],"Connection":["Upgrade"],"Sec-Websocket-Accept":["PIVfT3VFGVicvBMuIs9f/HSYILc="]},"status":101}
{"level":"debug","ts":1631097520.942973,"logger":"http.handlers.reverse_proxy","msg":"upgrading connection","upstream":"127.0.0.1:8003","request":{"remote_addr":"IPIP:52032","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8003","headers":{"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"],"Sec-Websocket-Key":["websocket.key"]}}}
{"level":"debug","ts":1631097525.420092,"logger":"http.handlers.reverse_proxy","msg":"connection closed","upstream":"127.0.0.1:8003","request":{"remote_addr":"IPIP:52032","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8003","headers":{"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"],"Sec-Websocket-Key":["websocket.key"]}},"duration":4.477046985}
{"level":"debug","ts":1631097526.612511,"logger":"layer4","msg":"connection stats","remote":"IPIP:52032","read":771,"written":10509906,"duration":6.101738768}
{"level":"debug","ts":1631097532.5297396,"logger":"tls.handshake","msg":"choosing certificate","identifier":"mydomain.com","num_choices":1}
{"level":"debug","ts":1631097532.529821,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"mydomain.com","subjects":["mydomain.com"],"managed":true,"issuer_key":"acme.zerossl.com-v2-DV90","hash":"hashcode"}
{"level":"debug","ts":1631097532.5298455,"logger":"tls.handshake","msg":"matched certificate in cache","subjects":["mydomain.com"],"managed":true,"expiration":1638662399,"hash":"hashcode"}
{"level":"debug","ts":1631097532.9571102,"logger":"layer4.handlers.tls","msg":"terminated TLS","remote":"IPIP:52042","server_name":"mydomain.com"}
{"level":"debug","ts":1631097532.9572647,"logger":"layer4.handlers.proxy","msg":"dial upstream","remote":"IPIP:52042","upstream":"127.0.0.1:8000"}
{"level":"debug","ts":1631097532.9589086,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"127.0.0.1:8004","request":{"remote_addr":"IPIP:52042","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8004","headers":{"Sec-Websocket-Key":["websocket.key"],"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"]}},"headers":{"Connection":["Upgrade"],"Sec-Websocket-Accept":["u5cdlu5W2lnrWQLQtxD6Taq++O8="],"Upgrade":["websocket"]},"status":101}
{"level":"debug","ts":1631097532.9589906,"logger":"http.handlers.reverse_proxy","msg":"upgrading connection","upstream":"127.0.0.1:8004","request":{"remote_addr":"IPIP:52042","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8004","headers":{"Sec-Websocket-Key":["websocket.key"],"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"]}}}
{"level":"debug","ts":1631097536.927742,"logger":"http.handlers.reverse_proxy","msg":"connection closed","upstream":"127.0.0.1:8004","request":{"remote_addr":"IPIP:52042","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8004","headers":{"Sec-Websocket-Key":["websocket.key"],"Sec-Websocket-Version":["13"],"X-Forwarded-For":["IPIP"],"X-Forwarded-Proto":["http"],"Connection":["Upgrade"],"User-Agent":["Go-http-client/1.1"],"Upgrade":["websocket"]}},"duration":3.968730112}
{"level":"debug","ts":1631097538.2261362,"logger":"layer4","msg":"connection stats","remote":"IPIP:52042","read":1008,"written":10589204,"duration":5.702411312}

http.log here:

{"level":"error","ts":1631097497.1767857,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:51993","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"Connection":["Upgrade"],"Sec-Websocket-Key":["UhMK2oPY4HzA+jmdbCNIGw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:17 +0800] \"GET /8001 HTTP/1.1\" 404 6735","user_id":"","duration":0.000111421,"size":6735,"status":404,"resp_headers":{"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Accept-Ranges":["bytes"],"Content-Length":["6735"],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"Etag":["\"qb3qt3573\""]}}
{"level":"error","ts":1631097498.4517317,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:51994","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"Sec-Websocket-Key":["I/HKNIt1uaOBdUrHDFeZSQ=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:18 +0800] \"GET /8001 HTTP/1.1\" 404 6735","user_id":"","duration":0.000097694,"size":6735,"status":404,"resp_headers":{"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"Content-Type":["text/html; charset=utf-8"],"Accept-Ranges":["bytes"],"Server":["Caddy"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Content-Length":["6735"],"X-Content-Type-Options":["nosniff"]}}
{"level":"error","ts":1631097500.4224265,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:51996","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["kfmeD0dquEhvaEy1m7aemw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:20 +0800] \"GET /8001 HTTP/1.1\" 404 6735","user_id":"","duration":0.000204947,"size":6735,"status":404,"resp_headers":{"Accept-Ranges":["bytes"],"Content-Length":["6735"],"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"]}}
{"level":"error","ts":1631097502.1738088,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:51998","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["+c3aYixUa0vkLlk9uQjvpA=="]}},"common_log":"IPIP - - [08/Sep/2021:18:38:22 +0800] \"GET /8001 HTTP/1.1\" 404 6735","user_id":"","duration":0.000104078,"size":6735,"status":404,"resp_headers":{"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Content-Length":["6735"],"Server":["Caddy"],"X-Content-Type-Options":["nosniff"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Accept-Ranges":["bytes"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"]}}
{"level":"error","ts":1631097503.9872165,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52000","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8001","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["zG//cFwo7T/aWeonWGSunw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:23 +0800] \"GET /8001 HTTP/1.1\" 404 6735","user_id":"","duration":0.000102274,"size":6735,"status":404,"resp_headers":{"Content-Length":["6735"],"X-Content-Type-Options":["nosniff"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Accept-Ranges":["bytes"],"Server":["Caddy"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"]}}
{"level":"error","ts":1631097509.7635381,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52006","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["NhGjlsHMA838N3IUhstn2A=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:29 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000094108,"size":6735,"status":404,"resp_headers":{"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Server":["Caddy"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Accept-Ranges":["bytes"],"Content-Length":["6735"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"]}}
{"level":"error","ts":1631097510.9704752,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52007","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["5j++1JTZbNd/nDnUR1Rh/w=="]}},"common_log":"IPIP - - [08/Sep/2021:18:38:30 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000096753,"size":6735,"status":404,"resp_headers":{"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Content-Length":["6735"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Accept-Ranges":["bytes"],"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"]}}
{"level":"error","ts":1631097511.3675778,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:37004","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Version":["13"],"Cf-Connecting-Ip":["IPIP"],"Cf-Worker":["cf.workers.dev"],"Accept-Encoding":["gzip"],"X-Forwarded-For":["IPIP"],"Cf-Ray":["68b78c3382f6eb41-LAX"],"X-Forwarded-Proto":["https"],"Connection":["Upgrade"],"Sec-Websocket-Key":["2soWKtUR1wZITQvbXmLfpQ=="],"Cf-Ew-Via":["15"],"Cdn-Loop":["cloudflare; subreqs=1"],"Upgrade":["websocket"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"User-Agent":["Go-http-client/1.1"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:31 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000130647,"size":6735,"status":404,"resp_headers":{"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Accept-Ranges":["bytes"],"X-Frame-Options":["SAMEORIGIN"],"Content-Length":["6735"]}}
{"level":"error","ts":1631097512.7853777,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52015","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["qpb+rkDSXTYfjAmisOUt6g=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:32 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000187975,"size":6735,"status":404,"resp_headers":{"X-Content-Type-Options":["nosniff"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Server":["Caddy"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"Accept-Ranges":["bytes"],"Content-Length":["6735"],"X-Frame-Options":["SAMEORIGIN"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"]}}
{"level":"error","ts":1631097513.0367463,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:39534","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Upgrade":["websocket"],"Cf-Ew-Via":["15"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Cf-Ray":["68b78c3de60c368c-LAX"],"Cdn-Loop":["cloudflare; subreqs=1"],"Cf-Worker":["cf.workers.dev"],"Accept-Encoding":["gzip"],"X-Forwarded-Proto":["https"],"Cf-Connecting-Ip":["IPIP"],"X-Forwarded-For":["IPIP"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Websocket-Key":["Bqxw7rNH9YZLO8Jis87Kdw=="],"Sec-Websocket-Version":["13"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:33 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000157738,"size":6735,"status":404,"resp_headers":{"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Content-Length":["6735"],"Server":["Caddy"],"X-Frame-Options":["SAMEORIGIN"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Accept-Ranges":["bytes"]}}
{"level":"error","ts":1631097514.4479496,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52019","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Key":["6bN+kohY7NXKXn7camr0UA=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:34 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000094709,"size":6735,"status":404,"resp_headers":{"Server":["Caddy"],"Etag":["\"qb3qt3573\""],"Accept-Ranges":["bytes"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Content-Length":["6735"]}}
{"level":"error","ts":1631097515.5760002,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:42954","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Cf-Worker":["cf.workers.dev"],"X-Forwarded-Proto":["https"],"User-Agent":["Go-http-client/1.1"],"Cf-Connecting-Ip":["IPIP"],"Sec-Websocket-Version":["13"],"Cf-Ew-Via":["15"],"Connection":["Upgrade"],"Cf-Ray":["68b78c4de7660cdf-LAX"],"Accept-Encoding":["gzip"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Websocket-Key":["dNUNBjJFHEYkFHVTDYq/rQ=="],"Upgrade":["websocket"],"X-Forwarded-For":["IPIP"],"Cdn-Loop":["cloudflare; subreqs=1"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:35 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.00013804,"size":6735,"status":404,"resp_headers":{"X-Content-Type-Options":["nosniff"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Content-Length":["6735"],"Server":["Caddy"],"X-Frame-Options":["SAMEORIGIN"],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Accept-Ranges":["bytes"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"]}}
{"level":"error","ts":1631097516.2776096,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52025","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8002","headers":{"Sec-Websocket-Key":["5r7xARBahO4LJCEuiC5hNw=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:36 +0800] \"GET /8002 HTTP/1.1\" 404 6735","user_id":"","duration":0.000155954,"size":6735,"status":404,"resp_headers":{"Last-Modified":["Fri, 29 May 2020 16:51:03 GMT"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Etag":["\"qb3qt3573\""],"Content-Type":["text/html; charset=utf-8"],"Accept-Ranges":["bytes"],"Content-Length":["6735"],"Server":["Caddy"]}}
{"level":"info","ts":1631097525.420356,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52032","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8003","headers":{"Sec-Websocket-Version":["13"],"Upgrade":["websocket"],"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["ly9zzRiaY5iYa7Ec0bCnMA=="]}},"common_log":"IPIP - - [08/Sep/2021:18:38:45 +0800] \"GET /8003 HTTP/1.1\" 0 0","user_id":"","duration":4.478228997,"size":0,"status":0,"resp_headers":{"Sec-Websocket-Accept":["PIVfT3VFGVicvBMuIs9f/HSYILc="],"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"],"Upgrade":["websocket"],"Connection":["Upgrade"]}}
{"level":"info","ts":1631097536.927871,"logger":"http.log.access.log1","msg":"handled request","request":{"remote_addr":"IPIP:52042","proto":"HTTP/1.1","method":"GET","host":"mydomain.com","uri":"/8004","headers":{"User-Agent":["Go-http-client/1.1"],"Connection":["Upgrade"],"Sec-Websocket-Key":["2mT4eE5OqTvCoXvaCari2Q=="],"Sec-Websocket-Version":["13"],"Upgrade":["websocket"]}},"common_log":"IPIP - - [08/Sep/2021:18:38:56 +0800] \"GET /8004 HTTP/1.1\" 0 0","user_id":"","duration":3.969616145,"size":0,"status":0,"resp_headers":{"Upgrade":["websocket"],"Connection":["Upgrade"],"Sec-Websocket-Accept":["u5cdlu5W2lnrWQLQtxD6Taq++O8="],"Server":["Caddy"],"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],"X-Content-Type-Options":["nosniff"],"X-Frame-Options":["SAMEORIGIN"],"X-Robots-Tag":["noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex"]}}

It seems the http matchers does not work, all websocket connections and URI path goes 127.0.0.1:8000, so how can I forward websocket connections with special path to a certain upstream server ?

@mholt
Copy link
Owner

mholt commented Sep 14, 2021

I'm guessing it's because the connection is TLS, not HTTP, based on the fact that you're terminating TLS. But terminating TLS after matching HTTP doesn't make any sense, since HTTPS works by putting HTTP inside TLS. So you first need to terminate TLS and then match HTTP.

@mholt mholt closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants