第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在Spring Cloud Gateway中添加額外的路徑到uri

如何在Spring Cloud Gateway中添加額外的路徑到uri

Smart貓小萌 2024-01-05 10:21:56
我想在 Spring Cloud Gateway 中為不同的 api 添加自定義路徑。我有兩個API:服務(wù)1:http://localhost:2121服務(wù) 1 的端點如下:http://localhost:2121/abc服務(wù)2:http://localhost:3434服務(wù) 2 的端點如下http://localhost:3434/abcAPI網(wǎng)關(guān):http://localhost:8090問題:我想將 service1 路徑添加到 API Gateway,并且我想重定向到服務(wù) 1示例 1:http://localhost:8090/service1/abc應(yīng)該重定向到http://localhost:2121/abc示例 2:http://localhost:8090/service1/anything應(yīng)該重定向到http://localhost:2121/anything服務(wù)2同樣的事情。我使用 Spring Cloud Gateway 的 yml 配置。spring:  application:    name: api-gateway  cloud:    gateway:      routes:        - id: service1          uri: http://localhost:2121        - id: service2          uri: http://localhost:3434提前致謝。
查看完整描述

1 回答

?
繁星淼淼

TA貢獻1775條經(jīng)驗 獲得超11個贊

spring:
????cloud:
????????gateway:
????????????routes:
????????????-??id:?service1
???????????????uri:?http://localhost:2121
???????????????predicates:
???????????????-???Path=/service1/**
???????????????filters:
???????????????-???StripPrefix=1
????????????-??id:?service2
???????????????uri:?http://localhost:3434
???????????????predicates:
???????????????-???Path=/service2/**
???????????????filters:
???????????????-???StripPrefix=1

那么映射'/service1/xxxx'的所有請求將代理到service_1'/xxxx'。

查看完整回答
反對 回復(fù) 2024-01-05
  • 1 回答
  • 0 關(guān)注
  • 241 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號