You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/06/04 08:39:34 UTC
[GitHub] [apisix] ieayoio opened a new issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
ieayoio opened a new issue #4376:
URL: https://github.com/apache/apisix/issues/4376
怎么在插件proxy-rewrite配置多个regex_uri实现不同url转发到不同的路径下
例如:
url:http://host1:9080/samplePrefix/get/service1
转发到
http://host2:8080/test
url:http://host1:9080/samplePrefix/get/service2
转发到
http://host2:8080/service
是不是只能做两条路由实现
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander closed issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4376:
URL: https://github.com/apache/apisix/issues/4376
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-854711992
Is this general enough to put it into proxy-rewrite? If it is for a special purpose, we can do it via a custom plugin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] ieayoio commented on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
ieayoio commented on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-854739198
其实我提出这个问题起因并没有这么复杂,只是通过快速入门,想在我原服务的基础上加一个前缀
例如原服务(tomcat):
```
http://host2:8080/service/
```
加前缀用如下形式替代:
```
http://host1:9080/prefix/service/
```
我进行了如下配置
```json
"proxy-rewrite": {
"regex_uri": ["^/prefix/service(.*)", "/service$1"]
}
```
当我访问http://host1:9080/prefix/service/,一切正常,我访问到了原服务http://host2:8080/service/的内容
问题出现在我访问http://host1:9080/prefix/service (没有了结尾的"/")
浏览器url却直接跳转到了http://host1:9080/service/,当然这个无法访问的
我分析原因,问题出现在原服务访问http://host2:8080/service会加/跳转到http://host2:8080/service/
因此,我任务最适合我的是配置两个regex_uri
分别为`"regex_uri": ["^/prefix/service", "/service/"]` 直接加/后缀
和`"regex_uri": ["^/prefix/service(.+)", "/service$1"]`
目前我已经通过配置两条路由解决了,能满足我的要求
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] ieayoio commented on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
ieayoio commented on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-855232777
Thank you. You're right
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] ieayoio edited a comment on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
ieayoio edited a comment on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-854739198
其实我提出这个问题起因并没有这么复杂,只是通过快速入门,想在我原服务的基础上加一个前缀
例如原服务(tomcat):
```
http://host2:8080/service/
```
加前缀用如下形式替代:
```
http://host1:9080/prefix/service/
```
我进行了如下配置
```json
"proxy-rewrite": {
"regex_uri": ["^/prefix/service(.*)", "/service$1"]
}
```
当我访问`http://host1:9080/prefix/service/`,一切正常,我访问到了原服务`http://host2:8080/service/`的内容
问题出现在我访问`http://host1:9080/prefix/service` (没有了结尾的"/")
浏览器url却直接跳转到了`http://host1:9080/service/`,当然这个无法访问的
我分析原因,问题出现在原服务访问`http://host2:8080/service`会加/跳转到`http://host2:8080/service/`
因此,我认为最适合我的是配置两个regex_uri
分别为`"regex_uri": ["^/prefix/service", "/service/"]` 直接加/后缀
和`"regex_uri": ["^/prefix/service(.+)", "/service$1"]`
目前我已经通过配置两条路由解决了,能满足我的要求
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-855169744
Maybe `"regex_uri": ["^/prefix/service/?(.*)", "/service/$1"]` can work for you? Unless you want to match `/prefix/serviceA`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-854610460
@ieayoio Currently, we have to use multiple routes to meet your demands. Also, PR's welcome to extend proxy-rewrite plugin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] ieayoio edited a comment on issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
ieayoio edited a comment on issue #4376:
URL: https://github.com/apache/apisix/issues/4376#issuecomment-854739198
其实我提出这个问题起因并没有这么复杂,只是通过快速入门,想在我原服务的基础上加一个前缀
例如原服务(tomcat):
```
http://host2:8080/service/
```
加前缀用如下形式替代:
```
http://host1:9080/prefix/service/
```
我进行了如下配置
```json
"proxy-rewrite": {
"regex_uri": ["^/prefix/service(.*)", "/service$1"]
}
```
当我访问`http://host1:9080/prefix/service/`,一切正常,我访问到了原服务`http://host2:8080/service/`的内容
问题出现在我访问`http://host1:9080/prefix/service` (没有了结尾的"/")
浏览器url却直接跳转到了`http://host1:9080/service/`,当然这个无法访问的
我分析原因,问题出现在原服务访问`http://host2:8080/service`会加/跳转到`http://host2:8080/service/`
因此,我任务最适合我的是配置两个regex_uri
分别为`"regex_uri": ["^/prefix/service", "/service/"]` 直接加/后缀
和`"regex_uri": ["^/prefix/service(.+)", "/service$1"]`
目前我已经通过配置两条路由解决了,能满足我的要求
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] Yiyiyimu closed issue #4376: request help: How to use proxy-rewrite add multiple regex_uri property
Posted by GitBox <gi...@apache.org>.
Yiyiyimu closed issue #4376:
URL: https://github.com/apache/apisix/issues/4376
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org