kedacore / http-add-on

Add-on for KEDA to scale HTTP workloads
https://kedacore.github.io/http-add-on/
Apache License 2.0
358 stars 95 forks source link

Http Addon Scaler Camel-casing the response Headers. #942

Closed kissandas closed 3 months ago

kissandas commented 6 months ago

Report

We sending request to HttPScaler, the response header names are getting camel-casing. For example- Request Header : vf-trace-transaction-id: c340af6-2377-44a3-a363-bc21cc423fb

Response Header : Vf-Trace-Transaction-Id: c340af6-2377-44a3-a363-bc21cc423fb

Expected Behavior

HTTP/1.1 200 OK Date: Fri, 15 Mar 2024 07:48:26 GMT vf-Trace-transaction-id: c340af6-2377-44a3-a363-bc21cc423fb X-Keda-Http-Cold-Start: false

Actual Behavior

HTTP/1.1 200 OK Date: Fri, 15 Mar 2024 07:48:27 GMT Vf-Trace-Transaction-Id: c340af6-2377-44a3-a363-bc21cc423fb

Steps to Reproduce the Problem

  1. Send a request passing through HttPScalerObject
  2. Check the response Headers for Camel-casing

Logs from KEDA HTTP operator

example

2024/03/12 14:17:43 maxprocs: Updating GOMAXPROCS=1: using minimum allowed GOMAXPROCS 2024-03-12T14:17:44Z INFO setup Starting manager 2024-03-12T14:17:44Z INFO setup KEDA Version: 2.13.1 2024-03-12T14:17:44Z INFO setup Git Commit: 41dd7a8558fdb274f2c0861f6c6d1eba01f2dcd5 2024-03-12T14:17:44Z INFO setup Go Version: go1.21.6 2024-03-12T14:17:44Z INFO setup Go OS/Arch: linux/amd64 2024-03-12T14:17:44Z INFO setup Running on Kubernetes 1.24 {"version": "v1.24.17"} 2024-03-12T14:17:44Z INFO setup WARNING: KEDA 2.13.1 hasn't been tested on Kubernetes v1.24.17

HTTP Add-on Version

0.7.0

Kubernetes Version

< 1.27

Platform

Amazon Web Services

Anything else?

Its bit urgent as due to this our logging is not working.

JorTurFer commented 6 months ago

Hello, Technically this is not a bug because the RFC describes the header fields as case-insensitive: https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2

Said that, I guess that we can check if there is any way to not modify them at all (it's the golang runtime proxy who does it, we aren't changing them in the code)

Are you willing to contribute with the fix?

kissandas commented 6 months ago

Thanks a lot for your quick response. I am really sorry I can't contribute now. Is there any workaround to bypass this as its impacting our logging flow ? Please suggest.

JorTurFer commented 6 months ago

It can't be bypassed AFAIK. Bypass is solving indeed xD The golang proxy is replacing the headers given that they are case-insensitive based on the RFC, so it's not a bug with a workaround, all the requests use the proxy

PatxD commented 5 months ago

This is the same problem as with Traefik ingress. We had to use Nginx ingress for a project that had a hard requirement on non-rfc headers. iirc, the issue was opened at the go library level, and it was refused. So I don't think this is something that will be "fixed". The answer is basically "make your code rfc compliant".

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 months ago

This issue has been automatically closed due to inactivity.