brighten1023 edited a comment on issue #784:
URL: 
https://github.com/apache/apisix-ingress-controller/issues/784#issuecomment-987523094


   ```
   apiVersion: apisix.apache.org/v2beta2
   kind: ApisixRoute
   metadata:
     name: frontend-route
   spec:
     http:
     - name: frontend
       match:
         hosts:
         - test.aaa.com
         paths:
         - /*
       backends:
          - serviceName: frontend
            servicePort: 80
       plugins:
          - name: proxy-rewrite
            enable: true
            config:
              regex_uri: ["^/(.*)", "/$1"]
   ```
   and
   ```apiVersion: apisix.apache.org/v2beta2
   kind: ApisixRoute
   metadata:
     name: backend-route
   spec:
     http:
     - name: backend
       match:
         hosts:
         - test.aaa.com
         paths:
         - /api/*
       backends:
          - serviceName: backend
            servicePort: 8080
       plugins:
          - name: proxy-rewrite
            enable: true
            config:
              regex_uri: ["^/api/(.*)$", "/api/$1"]
   ```
   Temporarily, I use apisix dashboard to create route and upstream, and it 
goes well
   ```//route frontend
   {
     "uri": "/*",
     "name": "frontend_route",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "plugins": {
       "proxy-rewrite": {
         "regex_uri": [
           "^/(.*)",
           "/$1"
         ]
       }
     },
     "upstream_id": "384232553139143705",
     "status": 1
   }
   ```
   and
   ```//route backend
   {
     "uri": "/api/*",
     "name": "backend_route",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "plugins": {
       "proxy-rewrite": {
         "regex_uri": [
           "^/api/(.*)",
           "/api/$1"
         ]
       }
     },
     "upstream_id": "384236511421269017",
     "status": 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.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to