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

feat(native): http_proxy from environment variables #12424

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/platforms/native/configuration/transports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ background thread or thread pool to avoid blocking execution.

## Using a Proxy

The Native SDK allows the configuration of an `HTTP` (`CONNECT`) or `SOCKS5` proxy through which requests can be tunneled to our backend. It can be configured via the following option interface:
The Native SDK allows the configuration of an `HTTP` (`CONNECT`) or `SOCKS5` proxy through which requests can be tunneled to our backend. It can be configured manually via the following option interface:

```c
sentry_options_t *options = sentry_options_new();
Expand All @@ -69,11 +69,24 @@ sentry_init(options);
/* ... */
```

You can also enable reading the `https_proxy`/`http_proxy` environment variable by setting the following option:
```c
sentry_options_t *options = sentry_options_new();
sentry_options_set_read_proxy_from_environment(options, true);
sentry_init(options);

/* ... */
```
Once this is set to true, any manually set proxy value will be ignored if a value exists in either the `https_proxy` or `http_proxy` environment variables. These get read in this order, so `https_proxy` has precedence over `http_proxy`.

We support `HTTP` proxies on all platforms, and `SOCKS5` proxies on Linux and macOS. Depending on the platform, the transport provides a fallback in case the proxy is not reachabled. The following table shows the expected behaviour.
### Proxy behavior

We support `HTTP` proxies on all platforms, and `SOCKS5` proxies on Linux and macOS. Depending on the platform, the default transport provides a fallback in case the proxy is not reachabled. The following table shows the expected behaviour.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We support `HTTP` proxies on all platforms, and `SOCKS5` proxies on Linux and macOS. Depending on the platform, the default transport provides a fallback in case the proxy is not reachabled. The following table shows the expected behaviour.
We support `HTTP` proxies on all platforms, and `SOCKS5` proxies on Linux and macOS. Depending on the platform, the default transport provides a fallback in case the proxy is not reachable. The following table shows the expected behavior:


| Platform | http-proxy | socks-proxy |
|----------|-----------------------------------------------------|------------------------------------------------------|
| Windows | Internal: fallback <br /> Crashpad: fallback | N/A |
| Linux | Internal: fallback <br /> Crashpad: fallback | Internal: no fallback <br /> Crashpad: no fallback |
| macOS | Internal: no fallback <br /> Crashpad: no fallback | Internal: no fallback <br /> Crashpad: fallback |

On Windows, `https` proxy servers are not supported by the default transport (WinHTTP).
Loading