2017-12-15 3 views
0

すべての要求を無条件にバックエンドに転送したいが、私はそれを訪問しようとすると404を取得し続ける。traefikはバックエンドに無条件転送のために404を返す

ドッキングウィンドウ-compose.yml

version: '3.3' 
services: 
    load-balancer: 
    image: traefik:1.5-alpine 
    ports: 
     - 8080:80 
    volumes: 
     - ./traefik:/etc/traefik 
    server1: 
    build: server1 
    ports: 
     - 8081:80 

traefik.toml

defaultEntryPoints = ["http"] 
debug = true 
logLevel = "DEBUG" 
[accessLog] 

[entryPoints.http] 
address = ":80" 

[frontends.dummy] 
backend = "dummy" 
entrypoints = ["http"] 
[frontends.dummy.routes.all] 
rule = "PathPrefix:/" 

[backends.dummy.servers.server1] 
url = "http://server1:80" 

私はローカルホストから問題なくサーバー1にアクセスすることができます:load-balancerコンテナ内部から8081とhttp://server1。しかし、最後のアクセスログは、コマンドから

curl localhost:8080                                                            

であり、それは私がしたくない

404 page not found 

を返さ404

デバッグログ

load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Traefik version v1.5.0-rc2 built on 2017-12-06_03:07:42PM" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg=" 
load-balancer_1 | Stats collection is disabled. 
load-balancer_1 | Help us improve Traefik by turning this feature on :) 
load-balancer_1 | More details on: https://docs.traefik.io/basic/#collected-data 
load-balancer_1 | " 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=debug msg="Global configuration loaded {"LifeCycle":{"RequestAcceptGraceTimeout":0,"GraceTimeOut":0},"GraceTimeOut":0,"Debug":true,"CheckNewVersion":true,"SendAnonymousUsage":false,"AccessLogsFile":"","AccessLog":{"format":"common"},"TraefikLogsFile":"","TraefikLog":null,"LogLevel":"DEBUG","EntryPoints":{"http":{"Network":"","Address":":80","TLS":null,"Redirect":null,"Auth":null,"WhitelistSourceRange":null,"Compress":false,"ProxyProtocol":null,"ForwardedHeaders":{"Insecure":true,"TrustedIPs":null}}},"Cluster":null,"Constraints":[],"ACME":null,"DefaultEntryPoints":["http"],"ProvidersThrottleDuration":2000000000,"MaxIdleConnsPerHost":200,"IdleTimeout":0,"InsecureSkipVerify":false,"RootCAs":null,"Retry":null,"HealthCheck":{"Interval":30000000000},"RespondingTimeouts":null,"ForwardingTimeouts":null,"Web":null,"Docker":null,"File":null,"Marathon":null,"Consul":null,"ConsulCatalog":null,"Etcd":null,"Zookeeper":null,"Boltdb":null,"Kubernetes":null,"Mesos":null,"Eureka":null,"ECS":null,"Rancher":null,"DynamoDB":null,"ServiceFabric":null,"Rest":null,"API":null,"Metrics":null,"Ping":null}" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Preparing server http &{Network: Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc42060ea60} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Starting server on :80" 
load-balancer_1 | 172.21.0.1 - - [15/Dec/2017:12:56:17 +0000] "GET/HTTP/1.1" - - - "curl/7.54.0" 1 - - 0ms 

を返すlocalhost:8080続けますドッカーのバックエンドを使用して、traefikに従来のラウンドロビンをコンテナ。それが可能かどうか疑問に思う?

答えて

0

大丈夫、たるみを接合した後、Machael Matulは、エントリポイント

[file] 

後にどこかで宣言され、バックエンドが機能するために、それはフロントエンドのルート宣言の前にする必要がありますが、 [ファイル]を必要になります指摘しました。 例:完全の

[frontends] 
    [frontends.frontend1] 
    backend = "buffalo" 
    [frontends.frontend1.routes.web] 
    rule = "Host:xyz.com" 
    entrypoints = ["http","https"] 

例:

debug = true 
logLevel = "DEBUG" 
defaultEntryPoints = ["https","http"] 

[accessLog] 

[web] 
address = ":8080" 
    [web.auth.basic] 
    users = ["admin:md5hashedpassword"] 

[acme] 
    email = "[email protected]" 
    storage = "/acme.json" 
    entryPoint = "https" 
    OnHostRule = true 
    [acme.httpChallenge] 
    entryPoint = "http" 

[entryPoints] 
    [entryPoints.http] 
    address = ":80" 
    [entryPoints.http.redirect] 
    entryPoint = "https" 

    [entryPoints.https] 
    address = ":443" 
    [entryPoints.https.tls] 

[file] 
watch = true 

[backends] 
    [backends.buffalo] 
    [backends.buffalo.loadbalancer.stickiness] 
    [backends.buffalo.servers.server1] 
    url = "http://node1:3000" 

    [backends.buffalo.servers.server2] 
    url = "http://node2:3000" 

    [backends.backendNginx] 
    [backends.backendNginx.loadbalancer.stickiness] 
    [backends.backendNginx.servers.server1] 
    url = "http://nginx1:8080" 

    [backends.backendNginx.servers.server2] 
    url = "http://nginx2:8080" 

    [backends.ai6forum] 
    [backends.ai6forum.loadbalancer.stickiness] 
    [backends.ai6forum.servers.server1] 
    url = "http://10.140.0.9:80" 

[frontends] 
    [frontends.frontend1] 
    backend = "buffalo" 
    [frontends.frontend1.routes.web] 
    rule = "Host:xyz.com" 
    entrypoints = ["http","https"] 
    passHostHeader = true 
    passTLSCert = true 
    priority = 10 

    [frontends.nginx] 
    backend = "backendNginx" 
    [frontends.nginx.routes.web] 
関連する問題