Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request-transformer rename is not preserving renamed header casing #11579

Closed
1 task done
l8nite opened this issue Sep 15, 2023 · 7 comments
Closed
1 task done

request-transformer rename is not preserving renamed header casing #11579

l8nite opened this issue Sep 15, 2023 · 7 comments
Assignees
Labels
plugins/request-transformer task/feature Requests for new features in Kong

Comments

@l8nite
Copy link

l8nite commented Sep 15, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

3.4.0

Current Behavior

Consider request-transformer configuration:

plugins:
- name: request-transformer
  service: foo
  config:
    rename:
      headers:
      - X-FOO-QixQux:X-BAR-QixQux

When renaming the header, the new value sent upstream is X-Bar-Qixqux

Expected Behavior

The expected header sent upstream is X-BAR-QixQux (case sensitive).

Now, according to HTTP RFC, the plugin behavior is OK; however, we have run into some implementation of upstream services that require strict http header casing, and it would be better if Kong preserved the renamed header casing.

This is similar to Issue #4504

Steps To Reproduce

Set up request-transformer plugin with the above config, execute request with inbound header that is renamed, observe the casing of the header sent to upstream.

Anything else?

No response

@StarlightIbuki StarlightIbuki added the task/feature Requests for new features in Kong label Sep 18, 2023
@StarlightIbuki
Copy link
Contributor

Thanks for reporting this. This might be a breaking change to make it case-sensitive but it looks alright: people who care about the case will write it correctly in the configuration. We will be discussing this.

@hanshuebner hanshuebner self-assigned this Sep 18, 2023
@hanshuebner
Copy link
Contributor

Created internal ticket KAG-2599

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

This issue is marked as stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Oct 5, 2023
@stale stale bot removed the stale label Oct 5, 2023
@ADD-SP ADD-SP removed the stale label Nov 6, 2023
@zyiqian
Copy link

zyiqian commented Dec 21, 2023

Hi @hanshuebner ,Has this issue been resolved? I seem to be encountering the same problem. When I rename the header, it doesn't seem to work. But the interesting thing is that when I add a new header it works。
My kong version is 3.1.1。

Plugin configuration:
apiVersion: configuration.konghq.com/v1 kind: KongPlugin metadata: name: request-transformer-remoteip plugin: request-transformer config: rename: headers: - RemoteIp:remoteip - X-Real-Ip:remoteip - X-Forwarded-For:remoteip add: headers: - X-Custom-Header:CustomValue

log:

message: header params name:X-Custom-Header,value:CustomValue
message: header params name:X-Forwarded-For,value:xxxxx

Looking forward to your reply, thank you.

@hanshuebner
Copy link
Contributor

Hi @zyiqian, I've followed up internally to see whether we can get this fixed.

windmgc pushed a commit that referenced this issue Jan 2, 2024
…names (#12244)

Request-transformer used to ignore cases when renaming header. This PR makes it case-sensitive when renaming headers.

Fix KAG-2599 #11579
@StarlightIbuki
Copy link
Contributor

#12244

@dndx
Copy link
Member

dndx commented Jan 5, 2024

We do not plan on addressing this issue due to widespread downstream impact, however, you should be able to use kong.service.request.set_headers and https://docs.konghq.com/hub/kong-inc/post-function/ to achieve the same goal.

@dndx dndx closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins/request-transformer task/feature Requests for new features in Kong
Projects
None yet
Development

No branches or pull requests

7 participants