1

I have deployed jHipster (v2.3) in Cloud Foundry using the jhipster subgenerator for cloud foundry. Following this the Gateway was also successfully deployed. During or after the deployment process, there are no errors or issues seen in log trace and routes have been created in CF.

Image of Gateway registred in jHipster Registry UI

Upon clicking the instance URL for the Gateway shown above, I get the below error:

502 Bad Gateway: Registered endpoint failed to handle the request

Corresponding log in Gateway is something like this:

 "GET /favicon.ico HTTP/1.1" 502 0 67 "http://XXXXXXX/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" 10.146.54.251:50172 10.146.54.148:62452 x_forwarded_for:"10.23.3.122, 10.146.54.251" x_forwarded_proto:"http" vcap_request_id:f63848c7-c58f-47cf-6c5a-cabf007dcc31 response_time:0.003393796 app_id:1b4faa60-05ec-41d7-a075-fe391e688739 app_index:0

Corresponding registry logs are below:

2017-07-09T17:12:41.961-04:00 [RTR/3] [OUT]  - [09/07/2017:21:12:41.958 +0000] "PUT /eureka/apps/GATEWAY/bb95da05-b1c5-46b5-4718-463f8022fd36:Gateway:mbo-gateway-2.0.0:8082?status=UP&lastDirtyTimestamp=1499633621406 HTTP/1.1" 200 0 0 "-" "Java-EurekaClient/v1.4.10" 10.146.54.243:46930 10.146.54.133:64594 x_forwarded_for:"10.146.54.148, 10.146.54.243" x_forwarded_proto:"http" vcap_request_id:85431f6c-a916-45a5-7498-2fe012ae2338 response_time:0.002340557 app_id:17cfd70b-8fcd-4d15-bac7-cd4a5b73a976 app_index:0

The application-cloudfoundry.yml file looks like this:

eureka:
instance:
    prefer-ip-address: false
    hostname: ${vcap.application.uris[0]}
    nonSecurePort: 80
client:
    enabled: true
    healthcheck:
        enabled: true
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
        defaultZone: http://username:password@jhipsterregistry.XXXXXX/eureka

The logs are not givng any indication what could be going wrong or what parameter I am missing.

If I deploy a simple microservice and make REST calls through Postman (by-passing the Gateway, the requests are going through fine. It appears to be an issue with Gateway alone.

Can someone please advise or provide inputs?

Many thanks!

barsakus
  • 77
  • 1
  • 9

1 Answers1

1

The problem has been solved.

Cloud Foundry port can only be 80 for HTTP.

  • Applications reading Spring Cloud Config Project from GitHub contained server port hardcoded to 8082, which was creating the problem. Once I commented this out, the Gateway was accessible.

Before changing the Cloud Config Project which helped address the issue, I did try to override the property by setting

spring.cloud.config.overrideSystemProperties = false
spring.cloud.config.overrideNone = true

in manifest.yml but that did not work.

One observation is that the applications having server.port property defined in configuration bundled as a part of the application (bootstrap.yml, application.yml) itself - and not Spring Cloud Config do get overridden at run time and hence those microservices did not face this issue.

barsakus
  • 77
  • 1
  • 9