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/10/06 07:15:15 UTC

[GitHub] [apisix] jujiale opened a new issue, #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   ### Description
   
   hello.
     we are using apisix v2.12. several days ago, I asked a question: [https://github.com/apache/apisix/issues/7978](url), then I add the follwing config in ngx_tpl.lua
   
   `
   
              {% if use_apisix_openresty then %}
               # For servers which obey the standard, when `:authority` is missing,
               # `host` will be used instead. When used with apisix-base, we can do
               # better by setting `:authority` directly
               grpc_set_header   ":authority" $upstream_host;
               {% else %}
               grpc_set_header   "Host" $upstream_host;
               {% end %}
   `
   
   then I use proxy-rewrite to modify the host. because we use apisix-base. so **grpc_set_header   "Host" $upstream_host;**  could not generate in nginx.conf when apisix start. the following is my config:
   
   `
   
        {
       "uri": "/helloworld.Greeter/SayHello",
       "name": "grpc-grpc",
       "methods": [
         "POST",
         "GET"
       ],
       "plugins": {
         "proxy-rewrite": {
           "host": "111.222.333.444"
         }
       },
       "upstream": {
         "nodes": [
           {
             "host": "172.25.219.22",
             "port": 50051,
             "weight": 1
           }
         ],
         "timeout": {
           "connect": 6,
           "send": 6,
           "read": 6
         },
         "type": "roundrobin",
         "scheme": "grpc",
         "pass_host": "pass",
         "keepalive_pool": {
           "idle_timeout": 60,
           "requests": 1000,
           "size": 320
         }
       },
       "status": 1
     }
   `
   what I find is host is not modified as I mentioned in config. because we need "host" in header to modify. **so I don't konw why when we use apisix-base. it only set  ":authority" instead of set "host"**.  I am not familiar with grpc.  wish your help. thanks.
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):2.12
   - Operating system (run `uname -a`):Linux 3.10.0-957.21.3.el7.x86_64
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):openresty/1.21.4.1
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):3.5.0
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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] jujiale commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   I want to know when I need to modify the "host" or add "host" in grpc header,  within current stiuation. should I modify the ngx_tpl.lua? because we have some upstream service which use "host" in grpc header


-- 
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] tokers commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   > > `:authority` is identical to `host` in HTTP/2.
   > 
   > @tokers I want to know. when our upstream grpc service picked host from grpc header "host", should I have some other way to add the header "host" to grpc header? because our upstream gprc service doesnot use header ":authority". and I find the grpc header doesnot have "host" default . I use proxy-rewrite plugin to add header. it failed too.
   
   Host is special, even if you add the host via proxy-rewrite plugin, it will be converted to `:authority` when APISIX forwards requests to upstream.


-- 
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] jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

Posted by GitBox <gi...@apache.org>.
jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite
URL: https://github.com/apache/apisix/issues/8040


-- 
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] tokers commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   `:authority` is identical to `host` in HTTP/2.


-- 
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] jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

Posted by GitBox <gi...@apache.org>.
jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite
URL: https://github.com/apache/apisix/issues/8040


-- 
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] jujiale commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   
   
   
   
   > `:authority` is identical to `host` in HTTP/2.
   
   @tokers
    I want to known. when our upstream grpc service picked host from grpc header "host", should I have some other way to add the header "host" to grpc header. because our upstream gprc service doesnot use header ":authority". and I find the grpc header doesnot have "host" default . I use proxy-rewrite plugin to add header. it failed too. 


-- 
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] jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

Posted by GitBox <gi...@apache.org>.
jujiale closed issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite
URL: https://github.com/apache/apisix/issues/8040


-- 
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] jujiale commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   > > > `:authority` is identical to `host` in HTTP/2.
   > > 
   > > 
   > > @tokers I want to know. when our upstream grpc service picked host from grpc header "host", should I have some other way to add the header "host" to grpc header? because our upstream gprc service doesnot use header ":authority". and I find the grpc header doesnot have "host" default . I use proxy-rewrite plugin to add header. it failed too.
   > 
   > Host is special, even if you add the host via proxy-rewrite plugin, it will be converted to `:authority` when APISIX forwards requests to upstream.
   
   thanks. I find in rfc it methiond the following.
   ![image](https://user-images.githubusercontent.com/48037235/194841140-b06e358c-69cc-4e5d-bfca-5a2e476557f2.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] jujiale commented on issue #8040: help request: apisix cloud't rewrite grpc header "host",with plugin proxy-rewrite

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

   > `:authority` is identical to `host` in HTTP/2.
   
   @tokers thank you very much


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