thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
210 stars 54 forks source link

fix: Remove unwanted host header before forwarding request to Cumulocity #2946

Closed jarhodes314 closed 1 week ago

jarhodes314 commented 1 week ago

Proposed changes

~This should fix a customer issue we have observed seemingly due to duplicate host headers from the c8y-auth-proxy. Currently it just removes the headers, although I am currently trying to reproduce the issue and write a test to verify it is now actually fixed.~

This fixes a bug in c8y_auth_proxy where the original headers were sent unmodified, meaning the Host header that was sent with the request originated from the request to the proxy, not the request the proxy makes to Cumulocity. This meant the request had a host of 127.0.0.1:8001 rather than the host that we were proxying to (e.g. xyz.cumulocity.com).

Types of changes

Paste Link to the issue


Checklist

Further comments

github-actions[bot] commented 1 week ago

Robot Results

:white_check_mark: Passed :x: Failed :next_track_button: Skipped Total Pass % :stopwatch: Duration
453 0 3 453 100 1h7m1.955003s
codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 70.58824% with 15 lines in your changes missing coverage. Please review.

Project coverage is 78.2%. Comparing base (23c2714) to head (bdff513). Report is 4 commits behind head on main.

Additional details and impacted files | [Files](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2946?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge) | Coverage Δ | | |---|---|---| | [crates/extensions/c8y\_auth\_proxy/src/server.rs](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2946?src=pr&el=tree&filepath=crates%2Fextensions%2Fc8y_auth_proxy%2Fsrc%2Fserver.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge#diff-Y3JhdGVzL2V4dGVuc2lvbnMvYzh5X2F1dGhfcHJveHkvc3JjL3NlcnZlci5ycw==) | `88.8% <70.5%> (-1.2%)` | :arrow_down: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2946/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge)