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 2022/09/07 13:54:46 UTC

[GitHub] [apisix] zar3bski opened a new issue, #7882: help request: remove the path from the call to the upstream service

zar3bski opened a new issue, #7882:
URL: https://github.com/apache/apisix/issues/7882

   ### Description
   
   I feel dumb by not finding it by myself but this behavior is quite surprising. I have the following route pointing to an elasticsearch kubernetes service
   
   ```json
   {
     "uri": "/elastic/*",
     "name": "elastic",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "upstream": {
       "nodes": [
         {
           "host": "elasticsearch-es-internal-http.default.svc",
           "port": 9200,
           "weight": 1
         }
       ],
       "timeout": {
         "connect": 6,
         "send": 6,
         "read": 6
       },
       "type": "roundrobin",
       "scheme": "https",
       "pass_host": "pass",
       "keepalive_pool": {
         "idle_timeout": 60,
         "requests": 1000,
         "size": 320
       }
     },
     "status": 1
   }
   ```
   When I reach the service through **apisix-gateway** with `curl http://localhost:30532/elastic/`, I would expect to end up on the root of the web service and to get 
   
   ```json
   {
     "name" : "elasticsearch-es-master-0",
     "cluster_name" : "elasticsearch",
     "cluster_uuid" : "qCuSnxgLTOSklJM13cH3XA",
     "version" : {
       "number" : "8.2.2",
       "build_flavor" : "default",
       "build_type" : "docker",
       "build_hash" : "9876968ef3c745186b94fdabd4483e01499224ef",
       "build_date" : "2022-05-25T15:47:06.259735307Z",
       "build_snapshot" : false,
       "lucene_version" : "9.1.0",
       "minimum_wire_compatibility_version" : "7.17.0",
       "minimum_index_compatibility_version" : "7.0.0"
     },
     "tagline" : "You Know, for Search"
   }
   ```
   (which is what I get when I `curl https://elasticsearch-es-internal-http.default.svc:9200`). Instead, I get 
   
   ```json
   {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [elastic]","resource.type":"index_or_alias","resource.id":"elastic","index_uuid":"_na_","index":"elastic"}],"type":"index_not_found_exception","reason":"no such index [elastic]","resource.type":"index_or_alias","resource.id":"elastic","index_uuid":"_na_","index":"elastic"},"status":404}
   ```
   as if I were reaching `https://elasticsearch-es-internal-http.default.svc:9200/elastic`. 
   
   How to remove `/elastic` from the call to the upstream service ?
   
   ### Environment
   
   - APISIX version: 2.15.0
   - Operating system (run `uname -a`):
   - OpenResty version : 1.21.4.1 / 
   - etcd version:8.3.4
   
   Deployed with Helm
   


-- 
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] zar3bski closed issue #7882: help request: remove the path from the call to the upstream service

Posted by GitBox <gi...@apache.org>.
zar3bski closed issue #7882: help request: remove the path from the call to the upstream service
URL: https://github.com/apache/apisix/issues/7882


-- 
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] zar3bski commented on issue #7882: help request: remove the path from the call to the upstream service

Posted by GitBox <gi...@apache.org>.
zar3bski commented on issue #7882:
URL: https://github.com/apache/apisix/issues/7882#issuecomment-1239485172

   OK got it 
   
   ```json
   {
     "uri": "/elastic/*",
     "name": "elastic",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "plugins": {
       "proxy-rewrite": {
         "regex_uri": [
           "/elastic/(.*)",
           "/$1"
         ]
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "elasticsearch-es-internal-http.default.svc",
           "port": 9200,
           "weight": 1
         }
       ],
       "timeout": {
         "connect": 6,
         "send": 6,
         "read": 6
       },
       "type": "roundrobin",
       "scheme": "https",
       "pass_host": "pass",
       "keepalive_pool": {
         "idle_timeout": 60,
         "requests": 1000,
         "size": 320
       }
     },
     "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] zar3bski commented on issue #7882: help request: remove the path from the call to the upstream service

Posted by GitBox <gi...@apache.org>.
zar3bski commented on issue #7882:
URL: https://github.com/apache/apisix/issues/7882#issuecomment-1239460564

   quite simple, actually
   
   ```json
   {
     "uri": "/elastic/*",
     "name": "elastic",
     "methods": [
       "GET",
       "POST",
       "PUT",
       "DELETE",
       "PATCH",
       "HEAD",
       "OPTIONS",
       "CONNECT",
       "TRACE"
     ],
     "plugins": {
       "proxy-rewrite": {
         "uri": "/"
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "elasticsearch-es-internal-http.default.svc",
           "port": 9200,
           "weight": 1
         }
       ],
       "timeout": {
         "connect": 6,
         "send": 6,
         "read": 6
       },
       "type": "roundrobin",
       "scheme": "https",
       "pass_host": "pass",
       "keepalive_pool": {
         "idle_timeout": 60,
         "requests": 1000,
         "size": 320
       }
     },
     "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] zar3bski closed issue #7882: help request: remove the path from the call to the upstream service

Posted by GitBox <gi...@apache.org>.
zar3bski closed issue #7882: help request: remove the path from the call to the upstream service
URL: https://github.com/apache/apisix/issues/7882


-- 
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