Spring Boot + Cloud | Zuul Proxy | 404-Fehler

Bin ich mit Spring Cloud-und Zuul-proxy als gateway für meine RESTful-service.

Gateway-Anwendung (Spring-Boot-web-app läuft auf port 8080) relevante code:-

Main-Klasse: -

@SpringBootApplication
@EnableZuulProxy
public class WebfrontApplication extends WebMvcConfigurerAdapter {

    /**
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(WebfrontApplication.class, args);
    }

}

Zuul Zuordnungen:-

zuul:
  routes:
    customer:
      path: /customer/**
      url: http://localhost:9000/

Während des Starts von oben UI-Gateway-Anwendung sehe ich in meinen logs, dass Zuordnungen für Proxys eingetragen sind:-

o.s.c.n.zuul.web.ZuulHandlerMapping      : Mapped URL path [/customer/**] onto handler of type [class org.springframework.cloud.netflix.zuul.web.ZuulController]

REST-Dienst (Eine Spring-Boot-web-app läuft auf port 9000) entsprechenden code:-

@RestController
@RequestMapping(value = "/customer")
public class CustomerController {

    @Autowired
    private CustomerService customerService;

    /**
     * Get List of All customers.
     * 
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public List<Customer> list(Principal principal) {
        return customerService.list();
    }
}

Mit einem rest-client (BRIEFTRÄGER in meinem Fall) ich bin in der Lage, eine Reaktion zu erhalten von oben endpoint erfolgreich (Sie kümmern auth-token).

Ich bin mit AngularJS für in-UI-Anwendung, um Daten aus der REST-Endpunkt.

Relevante code:-

angular.module('customerModule').factory('customerService',function($http) {

    return {
        customerList : function(){
            //PROBLEM !!!!!
            //THIS CALL GIVES A 404 ERROR
            return $http.get('/customer/list');
        }
    };
});

Dem oben genannten Aufruf gibt zurück ein 404 Fehler:-
Dies ist, was mein Chrome-debugger zeigt:-

Remote Address:127.0.0.1:8080
Request URL:http://localhost:8080/customer/list
Request Method:GET
Status Code:404 Not Found

Request-Header:-

Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,hi;q=0.6,ms;q=0.4
Cache-Control:no-cache
Connection:keep-alive
Cookie:SESSION=2e1ac330-fe41-4ff4-8efb-81eaec12c8d1
Host:localhost:8080
Pragma:no-cache
Referer:http://localhost:8080/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36
X-Auth-Token:2e1ac330-fe41-4ff4-8efb-81eaec12c8d1

Antwort-Header:-

Cache-Control:no-cache, no-store, max-age=0, must-revalidate
Content-Type:application/json; charset=UTF-8
Date:Fri, 20 Mar 2015 04:00:36 GMT
Date:Fri, 20 Mar 2015 04:00:36 GMT
Expires:0
Pragma:no-cache
Pragma:no-cache
Server:Jetty(9.2.9.v20150224)
Transfer-Encoding:chunked
X-Application-Context:bootstrap
X-Content-Type-Options:nosniff
X-Content-Type-Options:nosniff
X-Frame-Options:DENY
X-Frame-Options:DENY
X-XSS-Protection:1; mode=block
X-XSS-Protection:1; mode=block

Was ist hier falsch ? Sind Zuordnungen falsch oder übersehe ich etwas anderes?

GELÖST

Als pro die akzeptierte Antwort, die änderung der Zuul-mapping gearbeitet, wenn geändert:-

zuul:
 routes:
  resource:
   path: /customer/**
   url: http://localhost:9000/
   stripPrefix: false
Schreibe einen Kommentar