0

We have a complicated app based on Spring Cloud, Netflix Loadbalancer, to make calls between micro-services ms1<client>-->ms2<server> We are using a restTemplate.exchange call to a URI hostname that is a Eureka Key for FQDN lookup.

This configuration works in other micro-services, in fact the the restTemplate bean works for a different component's micro-service call.

The receiving the rest call is Cloud Foundry Go-router which I believe is just a ngineX proxy server, the httpClient request should have the header variable set to "Host":"FQDN" this allows the proxy to route the request to the proper instance in the space.

PROBLEM:

httpClient from ms makes the call to the ms

CompletionException. cause: org.springframework.web.client.HttpClientErrorException: 404 NOT_FOUND This is the response from the CF go-router (simple proxy server), the request never gets http--> the ms instance.

When the RestClient configures the request it sets the header "Host" as localhost:8090 or whatever the ms hostname is???

Discussion related Questions: So apparently we have a configuration problem here. Any advice on how the netflix ribbon loadbalancer client stuff sets the httpClient headers?
What package class interceptor does this magic?
What configuration variables effect this?

Code debugging indicates that netflix.client.SimpleVipAddressResolver is running.

We've traced the debug all the way to the Apache httpClient and it has the header Host set to the ms hostname, it's set to that value in the netflix httpClient wrapper too.

I tried to create a simple reference implementation of this, but can't.

Any recommendations on troubleshooting? Where to look or read docs on what com.netflix package?

Using the Camden Spring. Using profiles,

From the memory debugging;

ClientClassName:com.netflix.niws.client.http.RestClient
VipAddressResolverClassName:com.netflix.client.SimpleVipAddressResolver
NIWSServerListClassName:com.netflix.loadbalancer.ConfigurationBasedServerList
NFLoadBalancerClassName:com.netflix.loadbalancer.ZoneAwareLoadBalancer
NFLoadBalancerRuleClassName:com.netflix.loadbalancer.AvailabilityFilteringRule
EnablePrimeConnections:false, 
CustomSSLSocketFactoryClassName:null, 
TrustStorePassword:null, 
EnableConnectionPool:true, 
listOfServers:, 
OkToRetryOnAllOperations:false, 
RequestIdHeaderName:null

Our suspicion is that some application.properties, .yml, or bootstrap.yml is being set or not being set some where in the scan path ???.

ken
  • 666
  • 2
  • 6
  • 19

1 Answers1

0

We had just upgrade the platform spring boot 1.3.x to 1.4.2. The ms inbound controller had the annotation

@RequestHeader HttpHeaders httpHeaders

Which is what we attached into the restTemplate.execute as a parameter and eventually found it way to the rest-netflix-httpClient as the request headers being used to call the ms. The Go-Router on CF must be using that value to perform the proxying to the instance.

Apparently, somewhere in the upgrades, one of two things happen, either

A) boot Controller @RequestHeader in version 1.3.2 did not put header Host.

B) previous versions of spring Cloud-netflix-ribbon overwrote the Host httpHeader value with the Ribbon lookup.

Either way, there was no special interceptor. Spring cloud netflix Eureka will take whatever httpHeaders you provide (even if that header is key:Host and use those values.

Idan Str
  • 614
  • 1
  • 11
  • 33
ken
  • 666
  • 2
  • 6
  • 19