Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zuul-core: always cache full bodies, regardless of SSL
In the scope of Retrying POST bodies in response to 503's Zuul keeps a copy of the body to send again in certain circumstances. Normally, if the body has not been sent to the origin, and Zuul has not sent anything to the client, Zuul will compromise the HTTP spec and consider POSTs retryable. (Too many things depend on this wrong behavior; it would risky to change.) In the current code, Netty's SSL handler will mutate the body when sending it, so the ProxyEndpoint will keep a pristine copy of the body assuming the full body is present. In the case SSL was not requested, Zuul depends on Netty not clearing the buffers as it sends, and thus doesn't keep the copy around. Internally at Netflix, we want to automatically upgrade to SSL if possible, but that is only after the ProxyEndpoint code has decided to cache or not. An Origin may not explicit ask for SSL, but eventually use it, so it is too late to set the NIWS `IsSecure` bit and cache the body. (Requesting SSL is per Origin, using SSL is per Server). To ensure that 503's are retryable, and that we don't depend on Netty's HTTP subtleties, this change unconditionally caches the body, and pessimistically assumes that the body could be mutated. This allows for auto SSL upgrades later down the call chain as well. Sorry, no tests. This code definitely warrants a test, but it is ridiculously difficult to add one. I'm taking out a loan on our tech debt, which I hope to one day pay back.
- Loading branch information