The redirection was unsuccessful v3.3.2

I want to use traefik to implement redirect with domain replacement, but the configuration has not been effective yet

      - traefik.enable=true
      - traefik.http.routers.headscale.rule=Host(`headscale-test.cloud.com`)
      - "traefik.http.routers.headscale.entrypoints=web"
      - "traefik.http.middlewares.sslheader.headers.customResponseHeaders.Content-Security-Policy-Report-Only=upgrade-insecure-requests"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https,wss"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.Connection=upgrade"
      - "traefik.http.routers.headscale.middlewares=sslheader,headscale-redirectregex"
      - "traefik.http.middlewares.headscale-redirectregex.redirectregex.permanent=true"
      - "traefik.http.middlewares.headscale-redirectregex.redirectregex.regex=^https://headscale-test.cloud.com/register/(.*)"
      - "traefik.http.middlewares.headscale-redirectregex.redirectregex.replacement=https://p2pvpn-test.cloud.com/register/$${1}"

I changed HTTPS to HTTP and it worked, why

You original config seems strange. You listen on "web" entrypoint, but want to match in middleware the request URL with "https". That should never work.