Closed brendanheywood closed 7 years ago
Thanks Brendan, I see the need for this now. As you've suggested I'll get it to apply/respect the Moodle proxy settings. I think this is a better way than adding plugin specific proxy settings. DRY FTW
OK, I've created a branch for this called proxy. Which is very much a work in progress.
The Guzzle docs are easy to follow, and it was pretty easy just to hack in a static proxy on the get request method to test. However, I'm having issues resolving the Guzzle implementation with the Moodle implementation.
I don't have a setup available that actually uses Moodle's proxy settings. One of the things I'd like to know is in the moodle admin setings, what actually goes in the setting 'Proxy host' is it a domain like localhost
or an actual URI like http://localhost
.
I'd also like to know how (if at all) Moodle deals with HTTPS proxies, the Moodle docs here aren't helpful and I haven't been able to figure it out from the code.
I'll keep digging
AFAIK, only proxy machine hostname (or IP address) goes into $CFG->proxyhost field, without protocol definition.
This should be pretty much done now. I've updated the code to respect all of Moodle's HTTP proxy settings, including auth and bypass. There is unit test coverage of the functionality. I've also verified it's working using Squid as the proxy on my test rig. The only thing left to do is test it on a real setup, which I don't have at hand. @martindCatalyst are you able to pull the latest from the proxy branch and test it? If every thing checks out, I'll bump the version and merge it into master.
Hello @mattporritt On our environment with web servers not having access to elasticsearch instance, and using squid3 as HTTP proxy I can confirm this is working as expected.
All green from me.
Thank you for your work
Changes merged into master, new version released. Thanks all for your help.
http://docs.guzzlephp.org/en/latest/request-options.html#proxy
ie it should honor the stuff found inside:
/admin/settings.php?section=http