From 48ac424d69fbadd0cdf502b3964a1150005afcba Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Mon, 30 Sep 2024 08:44:12 -0400 Subject: [PATCH 1/2] Document some known gotchas in both ruby and python apps --- README.md | 6 +++++- docs/python.md | 8 ++++++++ docs/ruby.md | 11 +++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docs/python.md create mode 100644 docs/ruby.md diff --git a/README.md b/README.md index 70e7103..3897f3f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Deploying this egress proxy in front of your cloud.gov application will help you System(https_proxy, "web egress proxy", "proxy for HTTP/S connections") } } - + Boundary(external_boundary, "external boundary") { System(external_service, "external service", "service that the application relies on") } @@ -178,6 +178,10 @@ $ cf ssh myapp -t -c "/tmp/lifecycle/launcher /home/vcap/app /bin/bash" If that _doesn't_ look OK: You may be using the proxy in a new or unexpected way, or you may have found a bug. Please file an issue or otherwise contact the project's maintainers! +### Language references + +Gotchas found in each application language can be found within the [docs](./docs) folder. + ## How it works - The proxy runs [Caddy V2](https://caddyserver.com) diff --git a/docs/python.md b/docs/python.md new file mode 100644 index 0000000..7ff9217 --- /dev/null +++ b/docs/python.md @@ -0,0 +1,8 @@ +# Using cg-egress-proxy with a Python application + +## SSL Certificate errors + +It has been found that several Environment variables need to be set for various networking libraries to load the SSL certificate used to protect the TLS connection between the application and the proxy. The following variables have been used: + +* `REQUESTS_CA_BUNDLE` for the [requests](https://pypi.org/project/requests/) python library. +* `NEW_RELIC_CA_BUNDLE_PATH` for the [New Relic](https://pypi.org/project/newrelic/) SDK. diff --git a/docs/ruby.md b/docs/ruby.md new file mode 100644 index 0000000..8fe00a1 --- /dev/null +++ b/docs/ruby.md @@ -0,0 +1,11 @@ +# Using cg-egress-proxy with a Ruby application + +By default,[^1] `net/http` proxy support is limited to connecting to `http` proxies, and not `https` proxies. To make proxied connections in Ruby, use [Faraday](https://rubygems.org/gems/faraday) along with one of the following two adapters[^2]: + +* [faraday-typhoeus](https://rubygems.org/gems/faraday-typhoeus) +* [faraday-patron](https://rubygems.org/gems/faraday-patron) + +Both of those adapters should work out-of-the-box to configure themselves properly from the `http_proxy` and `https_proxy` environment variables and system certificate store. + +[^1]: As of September 30, 2024 +[^2]: Please update this list if you find more adapters that work. This is not exhaustive. From b080d71434c2a7d3ac9d43ed663d3ae89ab0b069 Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Mon, 30 Sep 2024 10:16:50 -0400 Subject: [PATCH 2/2] Update docs/python.md Co-authored-by: Bret Mogilefsky --- docs/python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/python.md b/docs/python.md index 7ff9217..3c91f10 100644 --- a/docs/python.md +++ b/docs/python.md @@ -2,7 +2,7 @@ ## SSL Certificate errors -It has been found that several Environment variables need to be set for various networking libraries to load the SSL certificate used to protect the TLS connection between the application and the proxy. The following variables have been used: +Several environment variables need to be set for various networking libraries to load the SSL certificate used to protect the TLS connection between the application and the proxy. The following variables have been used: * `REQUESTS_CA_BUNDLE` for the [requests](https://pypi.org/project/requests/) python library. * `NEW_RELIC_CA_BUNDLE_PATH` for the [New Relic](https://pypi.org/project/newrelic/) SDK.