Skip to content

feat(reponse-rewrite): allow using variable in the header#4194

Merged
imjoey merged 2 commits into
apache:masterfrom
spacewander:rrv
May 10, 2021
Merged

feat(reponse-rewrite): allow using variable in the header#4194
imjoey merged 2 commits into
apache:masterfrom
spacewander:rrv

Conversation

@spacewander

Copy link
Copy Markdown
Member

Fix #3727

Signed-off-by: spacewander [email protected]

What this PR does / why we need it:

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • 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 first

@spacewander
spacewander marked this pull request as ready for review May 7, 2021 05:27
@spacewander
spacewander requested review from Yiyiyimu and imjoey May 7, 2021 05:28
| body | string | optional | | | New `body` to client, and the content-length will be reset too. |
| body_base64 | boolean | optional | false | | Identify if `body` in configuration need base64 decoded before rewrite to client. |
| headers | object | optional | | | Set the new `headers` for client, can set up multiple. If it exists already from upstream, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. |
| headers | object | optional | | | Set the new `headers` for client, can set up multiple. If it exists already from upstream, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. The value can contain Nginx variable in `$var` format, like `$remote_addr $balancer_ip` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| headers | object | optional | | | Set the new `headers` for client, can set up multiple. If it exists already from upstream, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. The value can contain Nginx variable in `$var` format, like `$remote_addr $balancer_ip` |
| headers | object | optional | | | Set the new `headers` for client, can set up multiple. If it exists already from upstream, will rewrite the header, otherwise will add the header. You can set the corresponding value to an empty string to remove a header. The value can contain Nginx variables in `$var` format, like `$remote_addr $balancer_ip` |

Comment thread t/plugin/response-rewrite.t Outdated



=== TEST 24: rewrite header with variable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== TEST 24: rewrite header with variable
=== TEST 24: rewrite header with variables

Signed-off-by: spacewander <[email protected]>

@imjoey imjoey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
Thanks.

@imjoey
imjoey merged commit db5a5a9 into apache:master May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow using variable in the header of reponse-rewrite plugin

5 participants