Swagger用户界面在与https和Traefik作为反向代理一起使用时,在请求网址中添加:80到

时间:2018-12-17 05:16:07

标签: docker swagger microservices reverse-proxy traefik

我的应用程序基于微服务架构,并且都在Docker容器中运行,并以Traefik作为反向代理。当我尝试请求微服务时,请求网址会附加:80(https://example.com:80/myService)。

当我点击“试用”时!按钮,我得到一个空的响应正文,响应代码为0。

如果我请求不使用traefik作为反向代理,那么它可以很好地工作,例如http://hostname:8080/myService

有人可以帮助我吗,我是否需要在docker服务级别上为traefik添加一些标签,而无需修改代码。 另外,如果应该对swagger文档进行更改,我应该做哪些更改?

enter image description here

下面是用于参考的docker堆栈文件。

    gateway-app:
    image: "gateway-app-image"
    environment:
        - SPRING_PROFILES_ACTIVE=
        - SPRING_CLOUD_CONFIG_URI=
        - SPRING_DATASOURCE_URL=
        - SPRING_DATA_CASSANDRA_CONTACTPOINTS=
        - JHIPSTER_SLEEP=
        - JHIPSTER_LOGGING_LOGSTASH_HOST=
        - JHIPSTER_LOGGING_LOGSTASH_PORT=
        - SPRING_DATA_ELASTICSEARCH_CLUSTER-NAME=
        - SPRING_DATA_ELASTICSEARCH_CLUSTER_NODES=
        - SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS=
        - SPRING_CLOUD_STREAM_KAFKA_BINDER_ZK_NODES=zookeeper
        - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=
    networks:
        - traefik_proxy
    #ports:
     #   - 8080:8080

    logging:
        driver: "json-file"
        options:
            max-size: "100m" # The maximum size of the log before it is rolled
            max-file: "10"  # The maximum number of log files that can be present
    deploy:
      labels:
        - "traefik.port=8080"
        - "traefik.backend=gateway-app"
        - "traefik.docker.network=traefik_proxy"
        - "traefik.frontend.rule=Host:example.com"
        - "traefik.frontend.headers.SSLRedirect=true"
        - "traefik.enable=true"
      replicas: 1
      update_config:
        parallelism: 2
        delay: 10s
      restart_policy:
        condition: on-failure

0 个答案:

没有答案