You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "liuwenzhi0318 (via GitHub)" <gi...@apache.org> on 2023/04/12 06:16:24 UTC

[GitHub] [apisix] liuwenzhi0318 opened a new issue, #9292: How to use the request-id plugin to add multiple headers

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

   ### Current Behavior
   
   在请求接口时,需要增加多个 header 头。
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   {
     "_meta": {
       "disable": false
     },
     "algorithm": "uuid",
     "header_name": "X-B3-TraceId",
     "include_in_response": true
   }
   
   ### Environment
   
   ![image](https://user-images.githubusercontent.com/37536326/231367729-04ff7314-92fa-4d46-981d-41c390602c44.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.apache.org

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


[GitHub] [apisix] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504975136

   request-id is just a plugin name, and the plugin name can also be a header, I just need a function like this. I just need to automatically add my custom header after the external request or user request access to the apisix gateway


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504955013

   > how to deal with the value of the newly added header as a uuid or request-id plugin like ["uuid", "snowflake", "nanoid", "range_id"]
   
   you try to describe issues in Chinese.  I can't understand this expression.


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504995851

   agree wtih leslie-tsang
   
   to convert the ngx config file as follow.
   
   ```lua
   location / {
       content_by_lua_block {
           local http = require "resty.http"
           local httpc = http.new()
           local res, err = httpc:request_uri("http://upstream")
   
           if not res then
               ngx.say("failed to request: ", err)
               return
           end
   
           local req_id = ngx.var.pid .. "." .. ngx.var.msec .. "." .. ngx.var.remote_addr .. "." .. ngx.var.connection .. "." .. ngx.var.connection_requests
           ngx.req.set_header("X-Request-Id", req_id)
   
           ngx.say(res.body)
       }
   }
   
   ```


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505005266

   I hope that the official add header plug-in can realize this function. I think this function will be very practical.
   
   Compared with the request-id plugin, the code is similar to this
   
   `"plugins": [
    {
       "_meta": {
         "disable": false
       },
       "algorithm": "uuid",
       "header_name": "X-A-A",
       "include_in_response": true
     },
     {
       "_meta": {
         "disable": false
       },
       "algorithm": "uuid",
       "header_name": "X-B-B",
       "include_in_response": true
     }
   ]`
   


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505010952

    or   ![image](https://user-images.githubusercontent.com/37536326/231426533-30efd934-f192-4b18-bfa3-d0749a847396.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] leslie-tsang commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504970548

   > 我想实现 request-id 一样的功能,只是需要增加多个 header,并且value 是以类似uuid 随机生成的
   
   It sounds meaningless, the `request id` should be unique.


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504963578

   proxy-rewrite 插件我有了解,这个插件的怎么处理新增的 header的 value 值为一个 uuid 或者 request-id 插件类似那样的["uuid", "snowflake", "nanoid", "range_id"] 一个变量。 目前官网示例显示的是一个 str
   ![image](https://user-images.githubusercontent.com/37536326/231417484-d876aae7-257d-4bd3-80b3-9d10c72f6601.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] jiangfucheng commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "jiangfucheng (via GitHub)" <gi...@apache.org>.
jiangfucheng commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1506235377

   @Sn0rt @leslie-tsang Hi, I want to try implement this feature, could assign it to me?


-- 
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] leslie-tsang commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1506251611

   > @Sn0rt @leslie-tsang Hi, I want to try implement this feature, could assign it to me?
   
   First of All, thanks for your self-recommendation. :)
   
   Unfortunately, there is no such a scenario that would convince me to implement this feature in the open source 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] soulbird commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "soulbird (via GitHub)" <gi...@apache.org>.
soulbird commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1506248453

   I disagree, this feature is not generic, you can implement it in your own plugin. Or we can also see if more people want this feature


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504961677

   Are want to add a new algorithm for id generation ?


-- 
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] leslie-tsang commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504992123

   Maybe you could try adding a custom plugin to [register a var](https://apisix.apache.org/docs/apisix/plugin-develop/#register-custom-variable), and then reference that var in other plugins.


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505054377

    current the `request-id` not support this usage.
   however I think it's useful feature. we welcome you to implement this feature based on request-id plugin.
   
   @leslie-tsang cc


-- 
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] leslie-tsang commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504968354

   Please use english in public channel.


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504966743

   我想实现 request-id 一样的功能,只是需要增加多个 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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504977410

   similar   nginx  proxy_set_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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505013253

   > I hope that the official add header plug-in can realize this function. I think this function will be very practical.
   > 
   > Compared with the request-id plugin, the code is similar to this
   > 
   > ```
   > "plugins": {
   > "header":[
   >    {
   >       "algorithm": "uuid",
   >       "header_name": "X-A-A",
   >       "include_in_response": true
   >     },
   >   {
   >     "algorithm": "uuid",
   >     "header_name": "X-B-B",
   >     "include_in_response": true
   >   }
   > ]
   > }
   > ```
   
   This is very clear, I can understand it.
   You need two custom headers, whose value is automatically generated by the plugin (request-id).
   Your scenario may be that different components consume different http headers.
   
   Am I right?
   


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505030240

   > no. I need to set 2-3 headers in the same request
   
   yep.
   
   user A -- (raw http request)-> apisix -- > (http request with header [ A-A: xxx, B-B: xxxxaaa]  --> 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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1508024791

   thank you all;
   I have this consideration: If the function of this plug-in is used as a general plug-in, it will be a great enhancement to the function of grayscale release. Canary release can't just be done through the official traffic ratio, but more canary release through custom headers.


-- 
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] Sn0rt commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "Sn0rt (via GitHub)" <gi...@apache.org>.
Sn0rt commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504766001

   now. the `request-id` can't add new header to the user request.
   
   however, you can try add some new headers by 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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505039805

   Yes


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


Re: [I] How to use the request-id plugin to add multiple headers [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-2027013784

   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504921612

   I understand the proxy-rewrite plugin, how to deal with the value of the newly added header as a uuid or request-id plugin like ["uuid", "snowflake", "nanoid", "range_id"]


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1504983086

   Nginx is converted to apisix to use the actual operation method of the plug-in. This is just one of the headers, and multiple classes can also be configured in this way
   ```
   location / {
       proxy_pass http://upstream;
       set $req_id $pid.$msec.$remote_addr.$connection.$connection_requests;
       proxy_set_header X-Request-Id $req_id;
   }
   ```


-- 
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] liuwenzhi0318 commented on issue #9292: How to use the request-id plugin to add multiple headers

Posted by "liuwenzhi0318 (via GitHub)" <gi...@apache.org>.
liuwenzhi0318 commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-1505016480

   no. I need to set 2-3 headers in the same request
   


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


Re: [I] How to use the request-id plugin to add multiple headers [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #9292:
URL: https://github.com/apache/apisix/issues/9292#issuecomment-2053597926

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


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


Re: [I] How to use the request-id plugin to add multiple headers [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #9292: How to use the request-id plugin to add multiple headers
URL: https://github.com/apache/apisix/issues/9292


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