我有一个基本的.Net Core 3.1mvc
Web应用程序,该应用程序将混合流与Identity Server 4结合使用(基于它们的快速入门)。后者位于nginx
之后,Web应用程序位于nginx
和zuul
之后。当单击Web应用程序中的登录按钮时,我将重定向到Identity Server的登录页面。登录后,oidc
重定向失败,并且在我的Web应用程序日志中,我有一个相关ID cookie错误,指出它已丢失。
然后我将Web应用程序直接放在Identity Server之类的nginx
之后,并且通过oidc
登录和注销重定向,一切正常。
这是我在zuul
中的application.properties
配置>
zuul.sensitive-headers=Cookie,Set-Cookie zuul.ignored-services= '*' zuul.add-host-header=true server.port=9002 spring.application.name=zuul eureka.instance.preferIpAddress=true eureka.client.serviceUrl.defaultZone=${EUREKA_URI:http://localhost:9001/eureka} zuul.strip-prefix=false eureka.client.fetch-registry=true eureka.client.register-with-eureka=true
此配置中是否还需要其他解决方案?
我的nginx
配置为转发该Web应用程序的所有必要标头,但是当从zuul
进行代理时,很可能在下游丢失了某些内容。
location / { proxy_pass http://zuul:9002/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; }
全部使用Docker容器完成。
我有一个基本的.Net Core 3.1 mvc Web应用程序,该应用程序将混合流与Identity Server 4结合使用(基于它们的快速入门)。后者位于nginx后面,Web应用程序位于nginx后面,并且...
最终,这是一个非常简单的修复,因为我最初对zuul
文档有误解。我确实在上面所做的就是将Cookie列入黑名单: