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/12/03 04:07:39 UTC

[GitHub] [apisix-ingress-controller] brighten1023 opened a new issue #784: request help: regex_uri in proxy-rewriter

brighten1023 opened a new issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784


   ### Issue description
   I deployed a nginx server for frontend web, and a tomcat server for backend web. I want the traffic to go to backend when accessing '/api/*', and other traffic to go to frontend. Since I use the proxy-rewriter, I write the regex_uri: ["^/api/(.*)$", "/api/$1"] in the backend route, and regex_uri: ["^/(.*)","/$1"] in the frontend route. Now I access frontend web, everything is correct, but when I try to access backend web, it goes 404.  I guess the regex_uri may be wrong, but I don't know how to correct it.
   
   ### Environment
   
   * apisix-ingress-controller version 1.3;
   
   


-- 
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-ingress-controller] brighten1023 commented on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
brighten1023 commented 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"]` 
   `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
   }`
   `//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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tao12345666333 commented on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784#issuecomment-988528820


   And can you check the route record in Apache APISIX ?


-- 
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-ingress-controller] brighten1023 edited a comment on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] tokers commented on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784#issuecomment-987894374


   > ```
   > 
   > 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
   > 
   > }
   > 
   > ```
   > 
   > 
   
   The ApisixRoute configurations look good to me. But are there any logs printed by apisix ingress controller?


-- 
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-ingress-controller] tokers commented on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
tokers commented on issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784#issuecomment-986171321


   Please paste more details about the `ApisixRoute` that you created.


-- 
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-ingress-controller] brighten1023 commented on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
brighten1023 commented on issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784#issuecomment-1084672847


   I almost forgot this issue. The problem was solved by reinstalling the whole apisix and ingress controller, as well as the problem should be related to etcd cluster. This issue can be closed. Many thanks!


-- 
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-ingress-controller] brighten1023 edited a comment on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix-ingress-controller] brighten1023 closed issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
brighten1023 closed issue #784:
URL: https://github.com/apache/apisix-ingress-controller/issues/784


   


-- 
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-ingress-controller] brighten1023 edited a comment on issue #784: request help: regex_uri in proxy-rewriter

Posted by GitBox <gi...@apache.org>.
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-unsubscribe@apisix.apache.org

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