Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flashlight to pass as is HTTP responses with certain 4xx status codes #1121

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atavism
Copy link
Contributor

@atavism atavism commented Jul 13, 2021

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)

@atavism
Copy link
Contributor Author

atavism commented Jul 13, 2021

Marking as a draft for now. From @oxtoacart on Slack:

thinking about this a bit - a more reliable solution might be to have our servers return a header that identifies that the response came from us, much like Amazon’s servers do

if we see that header, we can always pass the response to the client no matter what the status code

So let's just do that instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant