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/02 02:34:17 UTC

[GitHub] [apisix] spacewander opened a new pull request #2917: fix: refresh cached header when we set request header

spacewander opened a new pull request #2917:
URL: https://github.com/apache/apisix/pull/2917


   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


----------------------------------------------------------------
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 a change in pull request #2917: fix: refresh cached header when we set request header

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #2917:
URL: https://github.com/apache/apisix/pull/2917#discussion_r534043957



##########
File path: apisix/core/request.lua
##########
@@ -68,12 +68,25 @@ function _M.header(ctx, name)
 end
 
 
-function _M.set_header(header_name, header_value)
+function _M.set_header(ctx, header_name, header_value)
+    if type(ctx) == "string" then
+        -- It would be simpler to keep compatibility if we put 'ctx'
+        -- after 'header_value', but the style is too ugly!

Review comment:
       @membphis 
   Added.




----------------------------------------------------------------
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 pull request #2917: fix: refresh cached header when we set request header

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #2917:
URL: https://github.com/apache/apisix/pull/2917#issuecomment-737090302


   @jenskeiner 
   Yes, you are 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.

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



[GitHub] [apisix] jenskeiner commented on pull request #2917: fix: refresh cached header when we set request header

Posted by GitBox <gi...@apache.org>.
jenskeiner commented on pull request #2917:
URL: https://github.com/apache/apisix/pull/2917#issuecomment-737082362


   @spacewander I reckon this would obsolete a similar change I made here: bfa4aa7297c14c181a7403daea4afdce2684040f Correct?
   
   I had noticed that setting a request header in `openid-connect` plugin would not be visible to the downstream `auth-keycloak` plugin since the headers there are retrieved from a cache which hadn't been updated.
   
   Better to fix in the core method anyway, so +1 for this change.


----------------------------------------------------------------
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] membphis merged pull request #2917: fix: refresh cached header when we set request header

Posted by GitBox <gi...@apache.org>.
membphis merged pull request #2917:
URL: https://github.com/apache/apisix/pull/2917


   


----------------------------------------------------------------
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] membphis commented on a change in pull request #2917: fix: refresh cached header when we set request header

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #2917:
URL: https://github.com/apache/apisix/pull/2917#discussion_r533973235



##########
File path: apisix/core/request.lua
##########
@@ -68,12 +68,25 @@ function _M.header(ctx, name)
 end
 
 
-function _M.set_header(header_name, header_value)
+function _M.set_header(ctx, header_name, header_value)
+    if type(ctx) == "string" then
+        -- It would be simpler to keep compatibility if we put 'ctx'
+        -- after 'header_value', but the style is too ugly!

Review comment:
       how about print a warning message to log?




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