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 external traffic calls to use the egress proxy #1445

Open
4 tasks
danivovich opened this issue Oct 10, 2024 · 1 comment
Open
4 tasks

Update external traffic calls to use the egress proxy #1445

danivovich opened this issue Oct 10, 2024 · 1 comment
Assignees

Comments

@danivovich
Copy link
Contributor

danivovich commented Oct 10, 2024

Context

The egress proxy is configured in the eval dev space. This work should then be set to merge to eval-main.

Finch is not working with the double proxy hop setup we ended up needing, but HTTPoison is working.

Tasks

  • Replace Finch calls with HTTPoison calls
  • Update tests that rely on Finch
  • Configure HTTPoison to use the egress proxy when configured (so that its not used locally or in test)
  • Remove Finch and any other HTTP library that isn't HTTPoison or a dependency of HTTPoison

Technical Detail

# If System.get_env("LOCAL_PROXY_HOST") is set, add options to the HTTPoison get calls that look like this:
options = [proxy: {System.get_env("LOCAL_PROXY_HOST"), 8888}] 
HTTPoison.get("https://www.google.com", [], options)

This is likely feasible to do in a module where use HTTPoison.Base is invoked, and then implementing the callback process_request_options so that these options are added to every call from that module.

Example Usage

Here is an example of the responses expected when the proxy allows vs denies traffic, so that you can get your pattern matches (although we probably handle {:error ...} the same way most of the time.

iex(19)> HTTPoison.get("https://yahoo.com", [], options)                                                                                                                                                                         
{:error, %HTTPoison.Error{reason: :proxy_error, id: nil}}                                                                      
iex(20)> HTTPoison.get("https://www.google.com", [], options)                                                                  
{:ok,                                                                                                                          
 %HTTPoison.Response{ ....

Deployment Target

This work must be based on eval-main and merge back to eval-main

@r-bartlett-gsa
Copy link
Member

r-bartlett-gsa commented Oct 22, 2024

Related Egress work:
#1437
GSA/Challenge_platform#31

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

No branches or pull requests

4 participants