Article transferred from https://www.cnblogs.com/waterlufei/p/7145746.html
Official Https://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.5.RELEASE/multi/multi__polyglot_support _with_sidecar.html
With Spring Cloud Sidecar's integrated heterogeneous language, did not take notes before, now do because of various pits and wasted a day, here to remember
First is official website: http://cloud.spring.io/spring-cloud-static/spring-cloud-netflix/1.3.1.RELEASE/
The official website said Sidecar is very simple, how to do here do not remember, just add the package, and then in the main function above the annotation, and then write something in the configuration file, and then crossing network on the line, here to remember what the official website did not mention
1.sidecar is used to integrate heterogeneous languages, such as you write with Python,nodejs and so on, sidecar this service must and Python or Nodejs and other heterogeneous language services on the same host, which means that they are localhost, Can't be IP access and so on
2.sidecar Check the health address of heterogeneous languages the results are:
{
"Status": "Up"
}
Here we need to note that this JSON result is not directly written by us, several times I was to facilitate directly in the return of the data written, if you start Sidecar, you will find that the registry sidecar has been down, that is because your response The header is not changed, so we can send the data to map, how to use the JSON packet into JSON data, the other way is also possible. In fact, the principle is response header inside parsing text/html, we should change to Application/json, if you really want to write a JSON data directly, it is necessary to change the response header of this interface, This is no trouble in one or two words.
3. Done we can access the interface of the heterogeneous language through the service name, walk the gateway, directly through the service name access is possible
Spring Cloud Sidecar