Skip to content
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

Can I set a http proxy for cached_network_image in my app? #96

Closed
jaggerwang opened this issue Nov 19, 2018 · 9 comments
Closed

Can I set a http proxy for cached_network_image in my app? #96

jaggerwang opened this issue Nov 19, 2018 · 9 comments

Comments

@jaggerwang
Copy link

As I know, cached_network_image use http package in the lower ground, but I can not found how to set proxy for http. Is this feature supported?

@renefloor
Copy link
Contributor

Not yet, will be supported in a future version.

@jaggerwang
Copy link
Author

Got it. Waiting for this feature, because my app very need this.

@renefloor
Copy link
Contributor

Do you still need this?

@jaggerwang
Copy link
Author

Not anymore. Thanks!

@codeknox
Copy link

codeknox commented Jun 6, 2020

Hey there, I'm actually searching for a solution to this issue, my app does need to access Internet through a proxy.

Do you want me to open a new issue?

@renefloor
Copy link
Contributor

@codeknox you can manipulate the http client of the cache manager. You can see how it is done for firebase here: https://github.com/Baseflow/flutter_cache_manager/tree/develop/flutter_cache_manager_firebase/lib/src

@expilu expilu mentioned this issue Jul 23, 2020
2 tasks
@mikezander
Copy link

mikezander commented Jul 7, 2022

@jaggerwang @codeknox Has anyone solved this? Not sure how to implement the answer @renefloor is suggesting. Thanks.

@mikezander
Copy link

@renefloor is this something you'd consider adding support for?

@nottmey
Copy link

nottmey commented Oct 14, 2022

@mikezander I recommend using a global setting for proxy configuration.

I don't know if you considered it, but you can override the default behaviour of any http client with

    // in your main
    HttpOverrides.global = YourProxyHttpOverrides();
class YourProxyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext? context) {
    final client = super.createHttpClient(context);
    final yourProxyIp = '...';
    final yourProxyPort = '...';
    client.findProxy = (uri) => 'PROXY $yourProxyIp:$yourProxyPort;';
    return client;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants