我想在zuul服务器中设置cookie路径。当我使用location.href重定向到网页而不通过zuul代理传递网页时,正在设置cookie路径。但是当我使用zuul代理重定向时,未在请求中设置路径。
zuul代理配置:
spring.application.name=api-gateway
eureka.client.service-url.defaultZone=${EUREKA_CLIENT_SERVICEURL_DEFAULTZONE:http://localhost:9000/eureka/}
server.port=9999
eureka.client.register-with-eureka=true
zuul.prefix=/api
zuul.routes.app-service.service-id=app-service
zuul.routes.user-service.service-id=user-service
zuul.host.socket-timeout-millis=30000
zuul.host.connect-timeout-millis=30000
spring.zipkin.base-url=http://localhost:9411/
spring.sleuth.sampler.probability=1
hystrix.command.default.execution.timeout.enabled=false
ribbon.ReadTimeout=60000
zuul.routes.app-service.sensitiveHeaders=
zuul.routes.user-service.sensitiveHeaders=
成功登录后,我试图将请求从用户服务重定向到应用。
window.location.href = "http://localhost:9999/api/app-service/App/";
document.cookie = "pc=test;expires=" + expirationDate+ ";path=/App/";
如果我如下更改,则cookie路径将设置为/ App /:
window.location.href = "http://localhost:8086/App/"
document.cookie = "pc=test;expires=" + expirationDate+ ";path=/App/";
如何解决该问题?