You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched open and closed issues to make sure that the bug has not yet been reported
Issue is a Bug Report
This is a bug report and not a feature request, nor asking for self-hosted support
Using official Plausible Cloud hosting or self-hosting?
Self-hosting
Describe the bug
First of all, thank you for the great work on this project!
Currently, the HTTPClient seems not support using HTTP or HTTPS proxies set via environment variables (HTTP_PROXY and HTTPS_PROXY). This functionality is important for users who need to route traffic through a proxy for various reasons, such as network restrictions or privacy concerns.
In my case, I'm facing network restrictions while connecting to Google services or Gravartor avatars.
Expected behavior
The HTTPClient should respect the HTTP_PROXY / HTTPS_PROXY environment variables and route HTTP/HTTPS requests through the specified proxy.
Where do the HTTP_PROXY and HTTPS_PROXY environment variables come from? Have they been documented somewhere?
I don't think we have them anywhere in the code base.
@ruslandoga Hi, thanks for replying. HTTP_PROXY and HTTPS_PROXY are environment variables used to specify proxy servers for HTTP and HTTPS traffic respectively. Many applications and libraries recognize and use these variables to route their network traffic through specified proxy servers, such as:curl, wget and Python’s requests library.
I see. We might be able to provide support for these env vars later, but for now we can at least make proxying configurable via custom config files. I'll open a PR for that later today with an example configuration.
importConfig# Plausible uses HTTPS for all outgoing requests, and our HTTP client (Mint) doesn't support HTTPS->HTTPS proxying# https://hexdocs.pm/mint/Mint.HTTP.html#connect/4-proxying recommends HTTP->HTTPS in this caseconfig:plausible,Plausible.Finch,conn_opts: [proxy: {:http,_host="some.proxy.com",_port=1080,_opts=[]}]
Note that you would need to provide your own proxy host/port pair. There is also an example config in #4270 where host and port are extracted from HTTP_PROXY env var.
Activity
ruslandoga commentedon Jun 24, 2024
👋 @HADB
Where do the
HTTP_PROXYandHTTPS_PROXYenvironment variables come from? Have they been documented somewhere?I don't think we have them anywhere in the code base.
HADB commentedon Jun 24, 2024
@ruslandoga Hi, thanks for replying. HTTP_PROXY and HTTPS_PROXY are environment variables used to specify proxy servers for HTTP and HTTPS traffic respectively. Many applications and libraries recognize and use these variables to route their network traffic through specified proxy servers, such as:
curl,wgetand Python’s requests library.ruslandoga commentedon Jun 24, 2024
I see. We might be able to provide support for these env vars later, but for now we can at least make proxying configurable via custom config files. I'll open a PR for that later today with an example configuration.
ruslandoga commentedon Jun 24, 2024
@HADB would you be able to try out the image I built from #4270?
Here're the changes you'd need to make:
docker-compose.yml
my_config.exs
Note that you would need to provide your own proxy host/port pair. There is also an example config in #4270 where host and port are extracted from HTTP_PROXY env var.
plausible-conf.env
+ EXTRA_CONFIG_PATH=/app/my_config.exsHADB commentedon Jun 27, 2024
@ruslandoga I have tried this image and it works as expected! Great job! Thanks a lot!