I have setup a local environment with a couple Spring Cloud services (config, service registry, and Zuul). The proxy correctly exposes the services using the default mapping:
2015-11-23 14:06:30.184 INFO 11532 --- [ main] o.s.c.n.zuul.web.ZuulHandlerMapping : Mapped URL path [/api-proxy/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]
2015-11-23 14:06:30.184 INFO 11532 --- [ main] o.s.c.n.zuul.web.ZuulHandlerMapping : Mapped URL path [/service-discovery/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]
2015-11-23 14:06:30.184 INFO 11532 --- [ main] o.s.c.n.zuul.web.ZuulHandlerMapping : Mapped URL path [/config-service/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]
2015-11-23 14:06:30.184 INFO 11532 --- [ main] o.s.c.n.zuul.web.ZuulHandlerMapping : Mapped URL path [/circuitbreaker-collector/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]
2015-11-23 14:06:30.184 INFO 11532 --- [ main] o.s.c.n.zuul.web.ZuulHandlerMapping : Mapped URL path [/circuitbreaker-dashboard/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]
The problem I am seeing is that when I go to http://localhost/service-discovery/ I see the Eureka dashboard but none of the related static resources load. Browser shows errors like:
http://localhost/eureka/css/wro.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/eureka/js/wro.js Failed to load resource: the server responded with a status of 404 (Not Found)
service-discovery:223 Uncaught ReferenceError: $ is not defined
http://localhost/eureka/css/wro.css Failed to load resource: the server responded with a status of 404 (Not Found)
Is there a way to get around this issue? From what I can tell Eureka dashboard isn't using a relative path when loading resources and instead assumes the app is deployed to the root servlet context.
UPDATE I realized I miss represented the problem. I commented on this thread but thought I would bring it up to the main post. The issue is that Zuul makes the backend request on behalf of the client. When Zuul makes that request the HTML response contains URL's that are relative to the context path that was configured for Eureka. Normally proxy services would manage this by re-writing any URLs found in the response to have the correct base context in regard to how the proxy is exposing it. Does something like this exist for Zuul?
Changed subject to better describe the issue.