【问题标题】:spring cloud Gateway ip forwardingspring cloud 网关ip转发
【发布时间】:2021-08-06 17:36:36
【问题描述】:

这是我将请求转发到我的网站的代码:

    @Bean
    public RouteLocator routToMyWebsite(RouteLocatorBuilder builder) {
        return builder.routes()
            .route("my-id", p -> p
                .path("/**")
                .uri("http://my-website.com"))
            .build();
    }

当我查看 my-website.com 中的 nginx 日志时,IP 地址是运行我的网关应用程序的机器的 IP。如何转发原IP地址?

【问题讨论】:

    标签: spring-cloud-gateway


    【解决方案1】:

    据我了解,XForwarded Headers Filter 是默认激活的。
    因此,如果您在 Nginx 日志中显示 X-Forwarded-For 标头,您应该会看到客户端的原始 IP。

    【讨论】:

      猜你喜欢
      • 2020-08-06
      • 2021-02-10
      • 2020-07-10
      • 2021-05-27
      • 2016-09-20
      • 2018-02-02
      • 2020-04-28
      • 2017-07-27
      • 1970-01-01
      相关资源
      最近更新 更多