登录后 Zuul post 提交重定向到遗留原件 url

Zuul after login post submit redirecting to legacy original url

我是zuul服务器的新手。我有一个遗留系统,我正试图使用​​ zuul 代理服务器扼杀它。我的 zuul 服务器是 运行 在本地机器上,我的遗留 spring MVC 系统具有 spring 安全性,在专用物理 tomcat 服务器上运行(例如 http://test-server.domain.com/legacySystem). When I enter a local proxy server URL with some path (ex. http://localhost:8080/legacySystem) zuul transparently proxyfies me to legacy server and in the browser address bar I see zuul server address (not the original server address). That's ok. But when, in the current window, I try to login and POST data to server zuul redirects me to original server and then in the browser address bar I see http://test-server.domain.com/legacySystem/login;jsessionid=7152B389D11583056C702BEB0BA20232 地址。登录post returns 代码302后的服务器。我的zuul配置。

---
zuul:
  routes:
      legacySystem:
          path: /legacySystem/**
          url: https://test-server.domain.com/legacySystem/

server:
    port: 8080  

ribbon:
    eureka:
        enabled: false

谁能帮我正确配置 zuul 服务器。关键是我无法更改遗留系统的配置和身份验证子系统。我想透明地将所有请求路由到遗留系统,稍后我将定义一些将用于访问微服务的路由。遗留系统通过简单的 DAO 身份验证提供程序使用 spring 安全性。在此步骤中,我不需要 zuul 和遗留系统之间的任何会话或 oAuth 令牌。提前致谢。

我不得不在我的 application.yml 文件中放入空的 sensitiveHeaders 标签

我也遇到过同样的问题。我通过将 class 添加到我的 Spring 启动网关项目来解决这个问题 文档参考:https://cloud.spring.io/spring-cloud-netflix/1.4.x/multi/multi__router_and_filter_zuul.html#zuul-redirect-location-rewrite

    import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
    import org.springframework.cloud.netflix.zuul.filters.post.LocationRewriteFilter;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;

    @Configuration
    @EnableZuulProxy
    public class ZuulConfig {

        @Bean
        public LocationRewriteFilter locationRewriteFilter() {
            return new LocationRewriteFilter();
        }
    }