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

How to set Proxy for TUSClient? #52

Closed
pratimsingha opened this issue Mar 14, 2022 · 3 comments · Fixed by #84
Closed

How to set Proxy for TUSClient? #52

pratimsingha opened this issue Mar 14, 2022 · 3 comments · Fixed by #84
Labels

Comments

@pratimsingha
Copy link

Question
How to set Proxy for TUSClient?

We are using TUSClient to upload a large file to a server in chunks. We are required to go via Proxy server (with authentication).
But when I see the createUpload method in TUSClient class, I see this below line:
HttpURLConnection connection = (HttpURLConnection) uploadCreationURL.openConnection();

I could not see any Proxy feature that we can enable or introduce. Please suggest.

Setup details
Please provide following details, if applicable to your situation:

  • Runtime environment: [Java Version 11]
  • Used tus-java-client version: [e.g. v0.4.3]
@Acconut
Copy link
Member

Acconut commented Mar 17, 2022

tus-java-client does not have any feature for proxy support yet. If you want to contribute one, feel free to open a PR. As a workaround you can set a proxy for all HttpUrlConnections as described in this article: https://manismaran.wordpress.com/how-to-use-httpsurlconnection-through-proxy-by-setproperty-url-connection-and-proxy-httpurlconnection/ If you want to modify the HttpUrlConnection to add authentication (or similar), you can override the prepareConnection method in your own subclass of TusClient: https://github.com/tus/tus-java-client/blob/master/src/main/java/io/tus/java/client/TusClient.java#L319

Hope that helps!

@Acconut Acconut mentioned this issue Jan 17, 2023
5 tasks
@Acconut
Copy link
Member

Acconut commented Jan 17, 2023

We will investigate into an easier way for setting proxies in the next major release: #78

@Acconut Acconut closed this as completed Jan 17, 2023
@pdenooijer
Copy link
Contributor

pdenooijer commented Mar 6, 2023

@Acconut as said by @LaravZ in #78 (comment). We could fix this pretty quickly and robust. Would you be open to review the code (provided we create a PR), merge it (after comments are resolved) and create a new release? The lack of this feature is blocking our implementation. We're behind a proxy for external connections, but don't want to use it for all request as most of them are local.

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

Successfully merging a pull request may close this issue.

3 participants