-
Notifications
You must be signed in to change notification settings - Fork 102
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
How to set curl proxy in config ? #45
Comments
This might not be possible just yet. Have you found a work-around in the meantime? None of the adapters I seem to document how to implement a proxy. The library If anyone can contribute to this discussion on how to implement proxies with Geocoder 3.x, please let us know. :) |
Closing this for now. No plans to implement unless someone can submit a PR for this, or a work-around can be documented. Haven't heard back from OP, please re-open if this is a critical issue. |
I don't know if its still relevant, I solve this way for temporarily:
in the .env file:
In the ProviderAndDumperAggregator.php I edited getArguments() function:
and copied requiresReader() function to this at the end:
Not perfect but working for me, obviously not working GeoIP2 reader with CULR together, but not needed for me. |
Reopening and will review in the near future. |
As a possible workaround you can extend Example with guzzle (though the principal idea can be adapted with curl too): // app/Support/GuzzleClient.php
<?php
namespace App\Support;
use GuzzleHttp\Client;
class GuzzleClient extends Client
{
public function __construct(array $config = [])
{
parent::__construct(['proxy' => 'proxy.example.com:3128', ...$config]);
}
} // config/geocoder.php
<?php
use App\Support\GuzzleClient;
return [
// ...
'adapter' => GuzzleClient::class,
// ...
]; As a bonus, you can use the pre-configured <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Support\GuzzleClient;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->app->extend(\Illuminate\Http\Client\Factory::class, function ($service, $app) {
return $service->setClient(new GuzzleClient);
});
} |
Hello,
In config/geocoder.php, how can I set the proxy?
I tried that :
But it doesn't work :-/
The text was updated successfully, but these errors were encountered: