sahendrickson Posted September 9, 2014 Report Share Posted September 9, 2014 I have a linux machine running the btsync web interface on http://localhost:8888. I have apache configured to proxy requests from https://myhost/btsync to http://localhost:8888. It works great except that webui.js constantly tries to access http://myhost/gui, which is incorrect. It should be trying to access http://myhost/btsync/gui. I've narrowed the problem down to a function in webui.js, line 468, which reads: requestToken: function(c, {var a = this;$.ajax({type: "POST",url: guiBase + "token.html?t=" + Date.now(),async: false}).done(function( f ){var e = f.match(/>([^<]+)</);if(e) {a.TOKEN = e[e.length - 1]c();}});}, The problem is that the value in "guiBase" is absolute. It's set to "/gui/". It is defined a little earlier in the file at line 431, which reads: var urlBase = "";var guiBase = urlBase + "/gui/";var proxyBase = urlBase + "/proxy"; This essentially hard codes btsync to only work when it is running as the root of a host. However, I have other services running on http://myhost/ that I don't want btsync to conflict with. To fix this, the values of urlBase, guiBase, and proxyBase can all be set relative paths (relative to .../gui/, which is where they are currently referenced from): // removed urlBase because we are using relative references nowvar guiBase = ""; // now a relative path to /gui from /guivar proxyBase = "../proxy"; // now a relative path to /proxy from /gui With that change, btsync works flawlessly at different url paths. Would you please incorporate that change? In case you're curious, here's my apache configuration: <Proxy http://localhost:8888*> Require all granted</Proxy><Location /btsync> ProxyPass http://localhost:8888 ProxyPassReverse http://localhost:8888</Location> Thank you,-- Scott Quote Link to comment Share on other sites More sharing options...
sahendrickson Posted September 11, 2014 Author Report Share Posted September 11, 2014 bump. Additionally, it appears that some of the redirects that do not involve java script are also absolute. If btsync is mapped to http://myserver/btsync, then Going to http://myserver/btsync should go to http://myserver/btsync/gui/, but instead it goes to http://myserver/gui/. The redirect sent from btsync is to "/gui/" rather than "gui/" -- Scott Quote Link to comment Share on other sites More sharing options...
JB09 Posted October 9, 2014 Report Share Posted October 9, 2014 BumpCausing issues with my reverse proxy when using 1.4.83 Quote Link to comment Share on other sites More sharing options...
RomanZ Posted October 10, 2014 Report Share Posted October 10, 2014 @all, Thanks for reporting. I'll check what can be done here. Quote Link to comment Share on other sites More sharing options...
JB09 Posted October 17, 2014 Report Share Posted October 17, 2014 @RomanZ any update on this? Quote Link to comment Share on other sites More sharing options...
RomanZ Posted October 20, 2014 Report Share Posted October 20, 2014 @JB09I'm on it - but don't have an answer yet. Plz stay tuned OR bump in a week if I do not respond Quote Link to comment Share on other sites More sharing options...
Moe Posted January 9, 2015 Report Share Posted January 9, 2015 *bump* Quote Link to comment Share on other sites More sharing options...
chr157 Posted February 19, 2015 Report Share Posted February 19, 2015 Just wondering whether this issue has been resolved in Sync 2.0? Thanks. Quote Link to comment Share on other sites More sharing options...
RomanZ Posted February 19, 2015 Report Share Posted February 19, 2015 @chr157We'll do our best to get it into 2.0, though there is some chance it will slip to next release. Quote Link to comment Share on other sites More sharing options...
chr157 Posted February 19, 2015 Report Share Posted February 19, 2015 No worries - thanks for the reply! Quote Link to comment Share on other sites More sharing options...
diamondsw Posted May 19, 2015 Report Share Posted May 19, 2015 (edited) I've been fighting with this particular bug, and was at first led astray by other threads that made it seem like simple HTML rewriting would do the trick - no such luck in client-executed Javascript. I assume this is all compiled into the Linux executable, as I can't locate anything on disk to edit; I can only make these changes on-the-fly in my browser. If anyone knows a way I can make this change permanent, please let me know! [EDIT: Found a way via nginx subs_filter!] This bug is especially offensive as it is going out of its way to create the bad behavior - doing nothing would have worked fine. Doubly-offensive in that it was reported eight months ago and never fixed despite how simple it is. In the v2.0 webui.js I'm looking at, start at line 1113 and delete the following lines:var urlBase = "";var guiBase = urlBase + "/gui/";var proxyBase = urlBase + "/proxy";Yes, delete entirely. None of this should exist. guiBase is causing the bug, proxyBase is completely unused, and urlBase is only used for guiBase/proxyBase, which will shortly be unnecessary. Then delete the references to guiBase on lines 1136 and 1156 - they're unnecessary. They should now look like this: 1136:url: "?" + params.join('&'),1156:url: "token.html?t=" + Date.now(),That's it - removing code fixes this bug. Here's my nginx configuration that rewrites the JavaScript on the fly: location /proxy/btsync/ { proxy_pass http://nas:8888/gui/; subs_filter_types text/javascript; subs_filter "/gui/" ""; } Edited May 19, 2015 by diamondsw Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.