You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "wavemoroc001 (via GitHub)" <gi...@apache.org> on 2023/02/12 18:29:40 UTC
[GitHub] [apisix] wavemoroc001 opened a new issue, #8842: help request: How to rewrite uri in custome format ?
wavemoroc001 opened a new issue, #8842:
URL: https://github.com/apache/apisix/issues/8842
### Description
Hi, I have uri like this '/api/service-a/account/me' then i want to rewrite it in this format `/service-a/account/me`.
I have look at proxy-rewrite but i still no idea to achieve my goal.
Cloud you give some advice ?
### Environment
- APISIX version (run `apisix version`): 3.1
- Operating system (run `uname -a`): Docker
- Plugin runner version, for issues related to plugin runners: proxy-rewrite
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] wavemoroc001 closed issue #8842: help request: How to rewrite uri in custome format ?
Posted by "wavemoroc001 (via GitHub)" <gi...@apache.org>.
wavemoroc001 closed issue #8842: help request: How to rewrite uri in custome format ?
URL: https://github.com/apache/apisix/issues/8842
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] wavemoroc001 commented on issue #8842: help request: How to rewrite uri in custome format ?
Posted by "wavemoroc001 (via GitHub)" <gi...@apache.org>.
wavemoroc001 commented on issue #8842:
URL: https://github.com/apache/apisix/issues/8842#issuecomment-1427292561
@An-DJ Thanks It work!
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] wavemoroc001 commented on issue #8842: help request: How to rewrite uri in custome format ?
Posted by "wavemoroc001 (via GitHub)" <gi...@apache.org>.
wavemoroc001 commented on issue #8842:
URL: https://github.com/apache/apisix/issues/8842#issuecomment-1427221112
@An-DJ
Like this ?
<img width="1306" alt="Screenshot 2566-02-13 at 09 02 10" src="https://user-images.githubusercontent.com/56395197/218354289-9bd76c6a-e12f-4cbf-95b5-0a95bfb76052.png">
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] An-DJ commented on issue #8842: help request: How to rewrite uri in custome format ?
Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8842:
URL: https://github.com/apache/apisix/issues/8842#issuecomment-1427258414
@wavemoroc001 Yes. You can refer to the demo below, which forwards all "/api/ip" requests
to "http://httpbin.org/ip".
```
curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
"plugins": {
"proxy-rewrite": {
"regex_uri" : ["^/api/(.*)", "/$1"]
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org": 1
}
},
"uri": "/api/ip"
}'
```
```
curl "http://localhost:9080/api/ip"
{
"origin": "127.0.0.1, x.x.x.x"
}
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] An-DJ commented on issue #8842: help request: How to rewrite uri in custome format ?
Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8842:
URL: https://github.com/apache/apisix/issues/8842#issuecomment-1427201974
From: https://apisix.apache.org/docs/apisix/plugins/proxy-rewrite/

--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] An-DJ commented on issue #8842: help request: How to rewrite uri in custome format ?
Posted by "An-DJ (via GitHub)" <gi...@apache.org>.
An-DJ commented on issue #8842:
URL: https://github.com/apache/apisix/issues/8842#issuecomment-1427207702
@wavemoroc001 Maybe `["^/api/(.*)", "/$1"]` is ur need?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org