Spring-cloud-netflix: spring cloud zuul when I access /routes,I get Full authentication is required to access this resource.and 401

Created on 4 Jul 2017  路  9Comments  路  Source: spring-cloud/spring-cloud-netflix

I follow the spring cloud official document,and write a demo about spring cloud zuul. I can access the other microservice through the zuul. but when I can access /routes,I get the following result

Whitelabel Error
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Jul 04 16:42:26 CST 2017
There was an unexpected error (type=Unauthorized, status=401).
Full authentication is required to access this resource.

this is my zuulapplication:
package com.rick.cloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

@SpringBootApplication
@EnableZuulProxy
public class ZuulApplication {

public static void main(String[] args) {
    SpringApplication.run(ZuulApplication.class, args);
}

}
and my application.yml:
spring:
application:
name: microservice-gateway-zuul
server:
port: 8040
eureka:
client:
service-url:
defaultZone: http://user:password@localhost:8761/eureka
instance:
prefer-ip-address: true

Most helpful comment

The response code is 401(Unauthorized), I guess that you may enable spring security, try this:

curl -u user:password 'localhost:8040/routes'

or disable endpoints.routes.sensitive, add property:

endpoints.routes.sensitive: false

All 9 comments

The response code is 401(Unauthorized), I guess that you may enable spring security, try this:

curl -u user:password 'localhost:8040/routes'

or disable endpoints.routes.sensitive, add property:

endpoints.routes.sensitive: false

@lowzj Thank u very much,the second one is useful.but when I try the first one I get 401, i don't know where was wrong.

Please see the documentation on actuator security. http://docs.spring.io/spring-boot/docs/1.5.4.RELEASE/reference/htmlsingle/#production-ready-sensitive-endpoints

spring boot 1.5 secure actoator's endpoint by default.
You Can set management.security.enabled=false to disable this feature.
Or, You Can add dependency spring-boot-starter-security into your project.

@spencergibb thanks

@eacdy thanks, by the way. I am watching your spring cloud video.it's awesome. keep going

@Rick-ye haha. Thanks a lot. First time ever making REC videos in Chinese.

@eacdy,do you make the spring cloud seluth and consul video?

@Rick-ye No plans. The video has quite bad applause rate. I'dont have the passion to go on.
Luckly we have build a community http://www.spring4all.com . Maybe you Should try it.
And also, you Can keep my blog URL in your mind:http://www.itmuch.com .You Will see blogs about Spring Cloud.

Was this page helpful?
0 / 5 - 0 ratings