如何在Traefik中代理WebSockets?

qua*_*nta 4 websocket upsource traefik

我正在尝试将Upsource设置为在Traefik后面工作:https://www.jetbrains.com/help/upsource/proxy-configuration.html

traefik正在侦听端口8008和8443(因为80/443将用于另一个):

--entryPoints='Name:http Address::8008 Redirect.EntryPoint:https' --entryPoints='Name:https Address::8443 TLS'
Run Code Online (Sandbox Code Playgroud)

码头标签:

labels:
  traefik.backend: upsource
  traefik.enable: "true"
  traefik.port: "8080"
  traefik.frontend.rule: "Host:review.domain.com"
Run Code Online (Sandbox Code Playgroud)

conf/internal/bundle.properties,base-url配置如下:

base-url=https\://review.domain.com\:8443/
Run Code Online (Sandbox Code Playgroud)

问题:

time="2017-09-20T03:23:59Z" level=error msg="Error getting ACME certificates [review.domain.com] : Cannot obtain certificates map[review.domain.com:acme: Error 400 - urn:acme:error:connection - Connection refused
Error Detail:
        Validation for review.domain.com:443
Run Code Online (Sandbox Code Playgroud)

为什么它验证端口443而不是8443?

而且,要在Nginx中代理WebSockets:

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_pass http://upsourcemachine.domain.local:1111;
        proxy_pass_header Sec-Websocket-Extensions;
Run Code Online (Sandbox Code Playgroud)

你能确认Traefik支持WebSockets吗?如果是这样,如何配置?

小智 6

Traefik处理websocket,您不需要任何特定的配置.

您的问题似乎更多地是关于Let的加密中的挑战.我们的加密不会在默认的其他端口上处理TLS Challenge,而Traefik的默认挑战是TLS :(

因此,您需要将Traefik配置为使用DNS质询 https://docs.traefik.io/configuration/acme/