Spring Cloud 重定向到GatewayFilter工廠

2024-01-05 17:36 更新

RedirectTo GatewayFilter工廠采用一個status和一個url參數(shù)。狀態(tài)應(yīng)該是300系列重定向http代碼,例如301。URL應(yīng)該是有效的URL。這將是Location標(biāo)頭的值。

application.yml。 

spring:
  cloud:
    gateway:
      routes:
      - id: prefixpath_route
        uri: https://example.org
        filters:
        - RedirectTo=302, https://acme.org

這將發(fā)送帶有Location:https://acme.org標(biāo)頭的狀態(tài)302以執(zhí)行重定向。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號