The question makes no sense to me. If anyone has any insight please comment.
The OP is asking for the integration between NGINX and Eureka. The former has to be configured through the nginx.conf file to be become aware of existing service instances and changes of their status. This information can be derived from the service registry of course.
This article from NGINX describes this integration when using Consul for service discovery. The project Consul Template reads information from Consul and generates the respective config file for NGINX.
On behalf of the OP: Does Spring Cloud Netflix provide the same to integrate Eureka with NGINX?
OK, that is helpful - the article is about the pattern, not the details of an implementation. The pattern is dynamically re-configuring a reverse proxy Nginx, using a service registry (so presumably the proxy has to be resolvable by clients of all the services, using a mapping from subdomain to service name or something). If any support for such a feature was provided in Spring Cloud it wouldn't really make sense for it to be Netflix specific, so something based on Spring Cloud Commons would be appropriate.
It looks to me like Nginx out of the box wouldn't really support this pattern anyway - you'd need the paid-for version (Nginx Plus), which has a configuration API. If there is a Java client for this API we could certainly see about how to integrate it. (But probably not in Spring Cloud Netflix.)
Hi Dave,
I didn't expect anything like this in Spring Cloud Netflix. So I`m totally fine with your answer.
However, let me clarify one or two things:
proxy_pass directive. Your mapping options are versatile, e.g. your could map api.my.com/foo-service to an internal IP 10.0.0.19. These mappings are defined in the configuration file nginx.conf. Now if you're in a scaling environment, you don't want to hardcode these IPs be make these dynamic.As I said in the beginning, I didn't expect this to be included in Spring Cloud Netflix. I think this would be worth a separate project.
You can do this by monitoring registry changes and modifying nginx.conf
there is a demo:
https://github.com/codingmiao/ngineureka
Most helpful comment
Hi Dave,
I didn't expect anything like this in Spring Cloud Netflix. So I`m totally fine with your answer.
However, let me clarify one or two things:
proxy_passdirective. Your mapping options are versatile, e.g. your could mapapi.my.com/foo-serviceto an internal IP10.0.0.19. These mappings are defined in the configuration filenginx.conf. Now if you're in a scaling environment, you don't want to hardcode these IPs be make these dynamic.As I said in the beginning, I didn't expect this to be included in Spring Cloud Netflix. I think this would be worth a separate project.