Traefik的SSL直通

时间:2018-09-15 17:15:36

标签: traefik

我需要直接将SSL连接发送到后端,而不是在Traefik上解密。后端需要接收https请求。

我尝试使用traefik.frontend.passTLSCert = true选项,但是在访问我的Web应用程序时出现“找不到404页面”错误,并且在Traefik容器上也收到了此错误

public class MyService extends IntentService {
    public MyService() { 
        super("MyService") 
    }

    @Override
    protected void onHandleIntent(@Nullable Intent intent) {       
        try {
            int i = 0;
            while(true) {
                Log.d("MyService", "i = " + String.valueOf(i));
                i++;
                Thread.sleep(1000);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }              
    }
}

您能提出任何解决方案吗?谢谢。

我正在使用Traefik 1.6.6版。

这是我用于应用程序容器的docker-compose.yml。

CRUD

我的Traefik容器的docker-compose.yml。

traefik       | time="2018-09-16T10:47:41Z" level=error msg="Failed to create TLSClientConfig: no TLS provided"
traefik       | time="2018-09-16T10:47:41Z" level=error msg="Failed to create RoundTripper for frontend frontend-Host-dev-mydomain-com-0: no TLS provided"
traefik       | time="2018-09-16T10:47:41Z" level=error msg="Skipping frontend frontend-Host-dev-mydomain-com-0..."

最后,我的traefik.toml文件。

version: '3'
services:
  app:
    image: webdevops/php-nginx-dev:7.2
    networks:
      - proxy
    volumes:
      - ./:/app
      - ../traefik/ssl/*.mydomain.com.crt:/opt/docker/etc/nginx/ssl/server.crt
      - ../traefik/ssl/*.mydomain.com.key:/opt/docker/etc/nginx/ssl/server.key
    environment:
      - WEB_DOCUMENT_ROOT=/app
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:dev.mydomain.com
      - traefik.docker.network=proxy
      - traefik.port=443
networks:
  proxy:
    external: true

3 个答案:

答案 0 :(得分:2)

passTLSCert将TLS客户端证书转发到后端,即,客户端通过TLS握手发送证书以证明其身份。

Traefik是HTTP反向代理。要直接与后端建立SSL连接,您需要反向代理TCP而不是HTTP,并且traefik不(还?)支持tcp(但是github上存在问题)。

Traefik不适合您的用例,有多种选择,envoy是其中之一。

答案 1 :(得分:2)

Traefik现在在其新的2.0版本中具有TCP支持-目前仍处于Alpha状态(2019年4月)。

请参见PR https://github.com/containous/traefik/pull/4587
以及https://github.com/containous/traefik/releases/tag/v2.0.0-alpha1的v2.0.0-alpha1发行说明,其中包含此TCP支持PR

因此,一旦2.0发布(可能在2-3个月内),HTTPS直通将成为可能。

答案 2 :(得分:2)

TCP路由器的新直通已可用:https://docs.traefik.io/routing/routers/#passthrough