[FreeBSD] HTTP_PROXY variable makes Restic commands failed

Host OS: FreeBSD 13.2-RELEASE amd64 GENERIC
Restic version: restic-0.15.2 (installed via pkg install -y restic)
Rest-server version: rest-server-0.11.0_13 (installed via pkg install -y rest-server-0.11.0_13)

Using HTTP_PROXY variable in /home/username/.cshrc on client side makes restic commands failed. For example:

# restic -r rest: init                    
enter password for new repository:                                                                                                                                                             
enter password again:                                                                          
Fatal: create repository at rest: failed: Fatal: server response unexpected: 403 Forbidden (403)

Squid proxy log:

1685086691.905 0 TCP_DENIED/403 326 HEAD - HIER_NONE/- text/html [User-Agent: Go-http-client/1.1\r\nAccept: application/vnd.x.restic.rest.v2\r\nHost:\r\n] [HTTP/1.1 403 Forbidden\r\nServer: squid\r\nMime-Version: 1.0\r\nDate: Fri, 26 May 2023 07:38:11 GMT\r\nContent-Type: text/html;charset=utf-8\r\nContent-Length: 3548\r\nX-Squid-Error: ERR_ACCESS_DENIED 0\r\nVary: Accept-Language\r\nContent-Language: en\r\nX-Cache: MISS from unknown\r\nX-Cache-Lookup: NONE from unknown:3128\r\nConnection: close\r\n\r\n]

After unsetting HTTP_PROXY variable (# unsetenv HTTP_PROXY) restic works as expected


  1. Is it possible to prevent restic using variable without unsetting HTTP_PROXY?
  2. Is it possible to implement option to restic code something like --use-proxy http://proxy_server_ip:port or --no-proxy?

Just run restic using HTTP_PROXY= restic -r rest: init

setenv HTTP_PROXY && restic -r rest: init

It’s not so convinient way but working and unfortunately it resets HTTP_PROXY variable globally.