Development:Implement a behind a proxy sync solution

I read an exchange about this topic on github and I believe that this excellent app would benefit from making it able to communicate behind the proxy. The are a few related topics on this forum but none is a clear request about making Joplin’s sync function work behind a proxy.

It appears there is a way to force node.js apps to go through a proxy with global-tunnel-ng

var globalTunnel = require('global-tunnel-ng');
 
globalTunnel.initialize({
    host: '10.0.0.10',
    port: 8080,
    proxyAuth: 'userId:password', // optional authentication
    sockets: 50 // optional pool size for each http and https
});

Read

Perhaps this is the way to go.

5 Likes

Hello,

I have just tried this way, and this works (tested with WevDAV through a proxy) !

Thanks for the suggestion !

I’m glad that it worked. I am surprised that the author did not take this suggestion seriously about a year ago when I mentioned it.

I hope that your success will attract more attention to this solution.

Thank you for letting me know.

If you have the time please provide a quick recipe describing how you have done it , what files have been modified, etc.

Thanks

@aviret Laurent mentioned he would add it, if there’s a solution that works. So if yours does, create a PR and you have added proxy support to Joplin. Wouldn’t that be something?

@bhlevca ir’s more than likely that Laurent missed your post. I did. And I try to read and look at every topic, but sometimes there are just too many.

Hello,

I have inserted your code and update my proxy server in the following file ElectronClient/app/gui/MainScreen.jsx. Then I have to load the module with ‘npm install global-tunnel-ng’, recompile and that’s it.

Greetings

Before doing a PR, I do not know how to get the system proxy config in Joplin or how to add the parameters in the sync config.

@aviret can you please blank out the user/pwd and host with ***** and send us the file ElectronClient/app/gui/MainScreen.jsx. You can zip it and attach it here.

Here is the file MainScreen.jsx.zip (5.4 KB)

Thanks, I’m gonna have a look at it.

Somehow, we have to find a way to make it work for all platforms.

I have made the test with a release from the tag 7ad407a8c8060b412640ef6066709b7e46c7dffb ( tag: v1.0.175 ), but now with the last release of master, I get this message when checking the config:
Cannot read property ‘proxy’ of undefined. I will redo a checkout to this release and keep you informed.

@tessus Found this: Sadly global-tunnel-ngis broken since Node.js 11.6.0 and according to one of the contributors it probably won’t support newer Node versions in the future.. I will continue with by switching from using global-tunnel-ng to global-agent.

@nVir Could you post a solution here with the global-agent? Some details about what files are modified, platform, file sources (Git or precompiled, etc.) thanks.

I just read that global-agent supports only node.js 12.0 and above. It will not work with older versions. A bit of a mess in the node.js networking world

Hello,

PR has been made, see: https://github.com/laurent22/joplin/pull/2515

Greetings