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 2020/12/24 06:22:15 UTC

[GitHub] [apisix] Ben0625 opened a new issue #3116: request help: To get route object and set headers

Ben0625 opened a new issue #3116:
URL: https://github.com/apache/apisix/issues/3116


   ### Issue description
   I want to get the self-defined parameter serve_name(which corresponds to Route one to one) printed in the 'access.log' by changing access_log_format ($http_serve_name). I want to set this parameter as an attribute in 'lables' of Route when setting a Route. The problem is, how can I get the corresponding Route object in the apisix original code after hitting a route and then set 'serve_name' of lables into the headers so that this attribute will be printed in the 'access.log'?
   
   ### Environment
   
   * apisix version: 2.0
   * OS: x86_64 GNU/Linux
   * OpenResty / Nginx version: openresty/1.17.8.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.

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



[GitHub] [apisix] spacewander commented on issue #3116: request help: To get route object and set headers

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


   Take a look at https://github.com/apache/apisix/commit/bdd00e1f55fd13cd3d2b12656ec1dc2d4e3f6e0b


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

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



[GitHub] [apisix] Ben0625 closed issue #3116: request help: To get route object and set headers

Posted by GitBox <gi...@apache.org>.
Ben0625 closed issue #3116:
URL: https://github.com/apache/apisix/issues/3116


   


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

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



[GitHub] [apisix] Ben0625 commented on issue #3116: request help: To get route object and set headers

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


   > Take a look at [bdd00e1](https://github.com/apache/apisix/commit/bdd00e1f55fd13cd3d2b12656ec1dc2d4e3f6e0b)
   
   Thanks a lot, I find the code in http_access_phase() of 'init.lua' very helpful. I just add one line to set attributes of matched route into 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.

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