当前位置:网站首页>Modify the request path using the streaming API of gateway
Modify the request path using the streaming API of gateway
2022-07-28 01:45:00 【Java Genie】
I saw this writing on the official website
spring:
cloud:
gateway:
routes:
- id: nameRoot
uri: https://nameservice
predicates:
- Path=/name/**
filters:
- StripPrefix=2
When the gateway forwarding request path is /name/blue/red when , Actually to nameservice forwarding nameservice/red request , Streaming is not given on the official website api Of chestnuts
You can use the following code to achieve
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("oauth",
f-> f.path("/oauth/**")
.filters(gatewayFilterSpec -> gatewayFilterSpec.rewritePath("/oauth",""))
.uri("lb://oauth")
).build();
}
But there are still problems , If you change the official website to streaming api To write , how did you know? name There must be blue Like the following
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("nameRoot",
f-> f.path("/name/**")
// Here's the problem
.filters(gatewayFilterSpec -> gatewayFilterSpec.rewritePath("/name/blue",""))
.uri("lb://nameservice")
).build();
}
hope
边栏推荐
- Article reproduction: super resolution network fsrcnn
- Docker builds MySQL master-slave locally
- Lecture 16 of project practice: using the open close principle to realize the commodity price rule engine
- What is the opening time of London Silver
- 开发 Flutter 录音功能的插件
- Develop plug-ins for the recording function of flutter
- Icml2022 | online decision transformer
- A comprehensive case of crawler learning -- visiting websites
- Summary: Prometheus storage
- Realize OCR language recognition demo (II) - display and interaction of pictures and recognition content
猜你喜欢

8000 word explanation of OBSA principle and application practice

Summary of common shortcut keys in idea

Icml2022 | online decision transformer

If you are still using WiFi, you will be out: li-fi is better!!!

LeetCode 2341. 数组能形成多少数对

Baidu PaddlePaddle easydl: when AI enters the factory, "small bearing" can also turn "big industry"

“你“想当测试/开发程序员吗?努力发芽的我们......
![[style set 1] tab](/img/b4/01575a37fcc69a7b4e39cade08413d.png)
[style set 1] tab

Let's move forward together, the 10th anniversary of Google play!

HarmonyOS 3正式发布:鸿蒙手机流畅安全,鸿蒙终端常用常新
随机推荐
Lecture 16 of project practice: using the open close principle to realize the commodity price rule engine
一些事情的思考
对迁移学习中域适应的理解和3种技术的介绍
Introduction and configuration of vsftpd
Hcip day 15
Centralized management of clusters
How to calculate the profit and loss of spot Silver
Advanced MySQL -- stored procedures and custom functions
Recursion related exercises
Oracle RAC cluster file directory migration
Cesium add dynamic pop-up
Codeforces暑期训练周报(7.14~7.20)
我的富二代朋友
Neuron 2.1.0 release: it supports sparkplug B specification and more complete industrial protocol support
HRD 1. a simple and reliable HRD detection method
在一个字符串里面统计给定字符串的个数
Can anime characters become "real people"? Paddegan helps you find the TA of "tear man"
[style set 1] tab
Leetcode 2351. the first letter that appears twice
My rich second generation friend