To resolve this issue you can add Defaults env_keep += "http_proxy https_proxy" to your /etc/sudoers file in order to keep those variables when switching to the secure path.this