Update flashlight to pass as is HTTP responses with certain 4xx status codes #1121
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.
In flashlight's proxied package, the dual fetcher--that executes HTTP requests using both chained and fronted servers--treats 4xx client error HTTP response codes--like 400 Bad Request and 401 Unauthorized--as requests that fail from being unable to connect to an upstream proxy. The relevant area of the code is here: https://github.com/getlantern/flashlight/blob/devel/proxied/proxied.go#L283
The reason the client 4xx error responses aren't passed as is already is because our fronted servers return a 403 forbidden error whenever we encounter a masquerade host on which domain fronting doesn't work and we were unable to differentiate between them.
Since the fronted servers only 403 errors, however, we can filter and pass as is 400 and 401 HTTP responses (since these typically signal client errors like the user entering invalid credentials)