3
votes

I'm working on a Spring Cloud Zuul gateway to put in front of my spring boot application. I use basic authorization on the applications side. When I do a call to the gateway with the proper authorization header I always get 401 Unauthorized

"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource"

But when I do the request directly towards the application it works.

1

1 Answers

8
votes

Specifying sensitive-headers property without Authorization value in Zuul routes will forward the Authorization header towards the application. By default it has hese values: Cookie,Set-Cookie,Authorization

bootstrap.yml:

zuul:
  ignoredServices: '*'
  routes:
    application:
      path: /application/**
      serviceId: application
      sensitive-headers: Cookie,Set-Cookie

More info: https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java#L118