我正在开发一个 Spring Cloud Zuul 网关,放在我的 Spring Boot 应用程序前面。我在应用程序端使用基本授权。当我使用正确的授权标头调用网关时,我总是得到 401 Unauthorized
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource"
但是当我直接向应用程序发出请求时,它可以工作。
我正在开发一个 Spring Cloud Zuul 网关,放在我的 Spring Boot 应用程序前面。我在应用程序端使用基本授权。当我使用正确的授权标头调用网关时,我总是得到 401 Unauthorized
"status": 401,
"error": "Unauthorized",
"message": "Full authentication is required to access this resource"
但是当我直接向应用程序发出请求时,它可以工作。
在 Zuul 路由中指定sensitive-headers
没有Authorization
值的属性会将 Authorization 标头转发给应用程序。默认情况下,它具有以下值:Cookie,Set-Cookie,Authorization
bootstrap.yml:
zuul:
ignoredServices: '*'
routes:
application:
path: /application/**
serviceId: application
sensitive-headers: Cookie,Set-Cookie