First: My goal is to have Zuul frontend all components of Spring Cloud. i.e. Eureka, Hystrix, others. I am finding that I can't get static resources to route properly. They show 404's in the browser.
Eureka example:
Access URL from Zuul: http://hostname/discovery/ this returns the page without any of the static resources.
In the browser it shows trying to get http://hostname/eureka/css/wro.css results in a 404.
The static resource is located @ http://hostname/discovery/eureka/css/wro.css
I have tried the following Zuul route configs:
No route config, just using default.
and
zuul:
routes:
discovery:
path: /discovery/**
stripPrefix: true
and
zuul:
routes:
discovery:
path: /discovery/**
stripPrefix: false
This same error happens with other Spring based applications such as VanRoy's spring-cloud-dashboard.
I did add a HAL browser to a different service and used a static folder under resources "using default static resource mapping behavior of Spring Boot" and that works properly.
Looks like I found a way to solve this problem.
If you have a UI based service being accessed from Zuul setting the context-path will bring the application and static resources into parity.
I now have Eureka and the Hystrix Dashboard working from the Zuul URL:
Below is what was changed in each to resolve the above issue.
server:
context-path: /${spring.application.name}
Note: Anyone wondering about the value of having the Spring Cloud Config, Spring Cloud Bus and RabbitMQ will soon discover that a URL change to Eureka means you have to refresh every service to establish discovery again. I have a decent number of services and it would take a good amount of time to find the dynamic AWS URL for each to refresh the config properties. The cloud bus meant /bus/refresh in Rabbit and everything came up.
Most helpful comment
Looks like I found a way to solve this problem.
If you have a UI based service being accessed from Zuul setting the context-path will bring the application and static resources into parity.
I now have Eureka and the Hystrix Dashboard working from the Zuul URL:
Below is what was changed in each to resolve the above issue.
Note: Anyone wondering about the value of having the Spring Cloud Config, Spring Cloud Bus and RabbitMQ will soon discover that a URL change to Eureka means you have to refresh every service to establish discovery again. I have a decent number of services and it would take a good amount of time to find the dynamic AWS URL for each to refresh the config properties. The cloud bus meant
/bus/refreshin Rabbit and everything came up.