1

I have deployed Registry, Gateway and a microservice to Cloud Foundry. The microservice is available in registry and has also registered successfully in Gateway.

When trying to invoke calls in Swagger UI, the Swagger-generated url goes thus:

https://<microservice_route_with_port>/api/service_name/api/action_name

The above fails with "No response from server" error.

When invoking through Swagger UI, the URL that I am expecting - and which is validated to be work fine through Curl call - is:

https://<gateway_route_without_port>/service_name/api/action_name

BTW, direct service call through CURL or POSTMAN works fine too (by-passing the Gateway):

https://<service_route_without_port>/api/action_name

The application.yml file has the below configuration:

eureka:
instance:
    prefer-ip-address: false
    hostname: ${vcap.application.uris[0]}
  1. How can Swagger point to the gateway_url_without_port when deploying the microservices to PCF? (I have used jHipster cloudfoundry subgenerator to deploy the service to PCF so it ought to have handled this internally?)
  2. Do I need to point the baseUrl to be the same as Gateway in swagger-ui/index.html or elsewhere in the subgenerator code?
  3. Or, is this something that can be done in manifest.yml by specificying explicit routes?

Thanks!

barsakus
  • 77
  • 1
  • 9

1 Answers1

0

The issue is fixed for the time being by specifying the hostname:

Docket docket = new Docket(DocumentationType.SWAGGER_2)
            .host(GATEWAY_ROUTE_WITHOUT_PORT) //Add
            .apiInfo(apiInfo)
            .forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class)
            .select()
            .paths(regex(DEFAULT_INCLUDE_PATTERN))
            .build();
barsakus
  • 77
  • 1
  • 9