airtasker / proxay

Proxay is a record/replay proxy server that helps you write faster and more reliable tests.
Other
72 stars 6 forks source link

Ignore Headers / Send Proxy Port / Dump Matcher Fails #604

Closed tft7000 closed 4 months ago

tft7000 commented 4 months ago

I added three flags that are needed in my situation and might be helpful for others:

--ignore-headers: Allows users to specify a list of headers that should be ignored by Proxay. This is especially useful together with the --exact-request-matching flag.

--send-proxy-port: Sends the proxays port to the proxied host, similar to nginx' proxy_set_header Host $host:$server_port;. This helps against redirect issues.

--dump-matcher-fails: Dumps the headers from the current and recorded request, if they are not matching. This helps to find headers that should be ignored in the specific situation.

For all three parts there are simple tests. I also added a paragraph in the Readme that documents those flags.

tft7000 commented 4 months ago

Note: OT: locally (on a mac) the test Persistence › persists binary encoded with gzip still compressed fails with "data": "H4sIAAAAAAAAA2MyUMqYzfiqhwmNBgCNSozuGAAAAA==", being slightly different by one character. However in the CI here the test seems to pass. I don't know the details, but it looks like there is a possibility that there are different (valid?) gzip implementations.

CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

timdawborn commented 4 months ago

Note: OT: locally (on a mac) the test Persistence › persists binary encoded with gzip still compressed fails with "data": "H4sIAAAAAAAAA2MyUMqYzfiqhwmNBgCNSozuGAAAAA==", being slightly different by one character. However in the CI here the test seems to pass. I don't know the details, but it looks like there is a possibility that there are different (valid?) gzip implementations.

Yup, I get the same, and I have the same conclusion that you had — it's another valid but different encoding.

tft7000 commented 4 months ago

@timdawborn : sorry, I had to revert the suggestion, because otherwise there will be a type problem (I think, because of safeHeaders: HttpHeaders).

timdawborn commented 4 months ago

@tft7000 Thanks! Do you have permission to merge this or do we need to merge it for you? (I can't easily check)

tft7000 commented 4 months ago

@timdawborn : thanks for the review! no, I do not have permissions. I would be happy, if you could merge / release it.

timdawborn commented 4 months ago

I would be happy if you could merge / release it.

I'll aim to create a release tomorrow my time.

timdawborn commented 4 months ago

@tft7000 This contribution is now in the 1.9.0 release: https://github.com/airtasker/proxay/releases/tag/v1.9.0

tft7000 commented 4 months ago

@timdawborn : Thanks for the quick review and merging / releasing. I appreciate your promptness.