Fix to ensure only one User-Agent header is added to request. #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background / history
Here at University of Skövde we have not been able to upgrade to versions > 4.18 of DSW since later versions are unable to communicate with our S3 storage (Qumulo based).
Errors received:
GeneralServerError "Error in S3: MErrValidation (MErrVJsonParse "Error in $: key \"Code\" not found")"(for example when putting a document template using dsw-tdk tool.)
Solution
Now when I'm more familiar with the project(s) in DSW and also been able to get a local development environment running I've been able to probe the behavior/issue deeper and I came up with the following information that hopefully backs the solution provided in PR:
Raw HTTP-response from S3-call (gathered from within minio-hs library after some local changes):
TLDR; Duplicate User-Agent headers not allowed here apparently even though the HTTP spec. is somewhat vague in this area but it explains at least why a plain 400 http status code is returned and thus the lack of "Code" element in the body expected in the S3-communication.
Request headers inspection
After setting log level to DEBUG and enabling httpClientDebug for wizard-server it is easy to shed some light on the issue:
TLDR; At line 8 we can see that there are duplicate User-Agent headers and that also got confirmed by my added logging inside the minio-hs library.
Fix
By ensuring that there's only one User-Agent header for the requests that passes through the HttpClientFactory we can address the issue(s) listed and I have also tested it locally and it works fine.
Note/thoughts: I wonder if there are redirects that are causing this issue, I've not been able to debug that further but it is just a possible conclusion that popped up between my ears.
Best regards,
Eddie