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

Using proxy to connect to webdav server #223

Closed
Lamachael opened this issue Oct 15, 2020 · 4 comments
Closed

Using proxy to connect to webdav server #223

Lamachael opened this issue Oct 15, 2020 · 4 comments

Comments

@Lamachael
Copy link

Hi, this lib looks like the perfect solution to my problem, however, I need to setup a proxy option to connect to a webdav server, is there any workaround for this that I haven't found yet, or is it possible to include this feature?

Thanks, Tamas.

@perry-mitchell
Copy link
Owner

Hi @Lamachael - To be honest I have no idea how this would work via a proxy, but I'm happy to mark this as an issue that needs investigation. I don't think it shouldn't need any special configuration, as it's the responsibility of the proxy to forward requests, intact, to the webdav service.

@Lamachael
Copy link
Author

Lamachael commented Oct 16, 2020

Thanks @perry-mitchell, you are right, if the proxy is set on the environment variables properly on the computer axios shall handle that, but if I only need a specific proxy to connect to the webdav server only than that needs to be set. I've found a workaround in the meantime, I'll just put it here maybe somebody else make use of it also. It's uses the tunnel package to create a httpsAgent that uses proxy.


const tunnel = require("./node_modules/tunnel") //this is the path to your node modules, maybe different for you
const agent = tunnel.httpsOverHttp ({
    proxy: {
        host: 'name-of-your-proxy',
        port: 8000 //use the port that is required for your proxy
    }
})

const client = createClient("webdav-server", { username: 'username', password: 'password',  httpsAgent: agent});

@perry-mitchell
Copy link
Owner

@Lamachael This looks quite nice, and I think it'd be acceptable to use this as a guide for others trying to connect via a proxy. I don't think additional support beyond custom agents is necessary, but I'm happy to discuss an alternative if something better is possible.

@perry-mitchell
Copy link
Owner

Closing this - if there's a way to implement this correctly I'd be interested in discussing it, but imo this is the responsibility of the connecting agent, which is already configurable.

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

No branches or pull requests

2 participants