Welcome! Log In Create A New Profile

Advanced

Web browser not being able to load UI, and using a web proxy to fix it

Posted by jstck 
Web browser not being able to load UI, and using a web proxy to fix it
June 30, 2014 02:15PM
Every so often, I have been unable to run the web ui in the browser. I get the web page, but it never "gets going", it is disconnected and all the buttons (including "Connect") are disabled.

Usually I have just reloaded the page (sometimes switching between Safari and Chrome for no good reason, sometimes opening a new browser window) and it usually gets going eventually. The other day I just couldn't connect no matter what I tried, so I dug a little bit deeper.

After just looking at the JavaScript console, it seems the web page can't load all the resources, and hence never runs the document.ready() event handler in reprap.js (or it runs and fails), which is what makes the whole thing come alive. I get "Connection reset" errors on various files. Usually it is bootstrap-slider.min.css, sometimes main.css (in which case the whole page is all "style-less" and plain), and in this case, jquery-2.1.0.min.js. Though which elements bug out when is very anecdotal. Looks thus:



Whenever I try to load a single resource (whichever one caused the error, or anything else for that matters) it always succeeds, so it seems to happen whenever the browser is trying to load lots of things at once. This has happened now and then in the past (with the "new" web UI), but it might (again, anecdotally)be worse in 0.95 as yesterday and today (after flashing) I was unable to load the web ui at all. If so, it might be because it adds a couple new files for the sliders, and more files means higher likelihood of one failing.

This is just a hunch, but I think it might get worse if I have a "faster LAN". I had the Ormerod in another place connected to a wifi bridge thingy, and sometimes via a switch. Now, I have it connected straight to my home router/switch/accesspoint, the same one my laptop connects to via wifi. It's all on the same local network, but there are fewer switches and wifi devices in between than ever before. Faster LAN might mean more stuff gets requested in a shorter time span or something, and that increases chances of failure. Again, I'm mostly speculating in this.

How does the RepRapFirmware behave when multiple files are requested at once? Can things somehow be improved? Can the browser somehow be told to do fewer simultaneous http requests?


One obvious simple fix is to have the web resources on a separate server (as I believe was the recommended way in the past). The Duet just needs to serve reprap.htm (or ajax calls are not allowed to it from that page), everything else can come from another server. The problem then is that whenever you update the web ui, you have to hand-hack reprap.htm, and also update files in two different places. I tried a slightly different approach, I set up an nginx proxy on my local linux server, that serves static content locally (including reprap.htm) and just forwards the ajax calls on to the printer. Config there looks like this:
server {
	root /usr/share/nginx/www;
	index index.html index.htm;

        allow 192.168.0.0/24;
        allow 127.0.0.0/8;
        deny all;

	location / {
          #Note. Replace htttp with http below, and of course your printer IP. I fudged it to prevent the forum system to mangle the url.
          proxy_pass htttp://192.168.0.14/;
	}

        location ~ \.(css|htm|js|png|ico|eot|svg|ttf|wof)$ {
          root /home/jstck/ormerod/;
        }
}


Anything with an extension matching one of the files found in the web ui is served out of /home/jstck/ormerod/, everything else gets forwarded on to 192.168.0.14 which happens to be my printer. That directory is just a clone of the git repo, so there is no need to edit any files, they all go in one place and are updated with one single command, and I can update them without having to touch the sd card in the duet. If I'm fiddling around with the web ui (which I am now and then trying silly things), I can even have multiple versions of it running side by side.

Edited 1 time(s). Last edit at 06/30/2014 02:16PM by jstck.
Re: Web browser not being able to load UI, and using a web proxy to fix it
June 30, 2014 04:51PM
Hi jstk,

I have my Ormerod and PC connected to the same 100Mbps Ethernet switch, and I find the connection very reliable. Just occasionally the web interface comes up but the Connect button doesn;t become active, and I have to refresh the page. I've always thought that problems arose more often when there is a slower or less reliable link such as WiFi between PC and Duet.

There are some improvements to the networking system in the pipeline, so I hope to have an update that you can try soon - but first I have to ship around 35 of my new hot end boards.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Web browser not being able to load UI, and using a web proxy to fix it
September 01, 2014 07:57AM
Hi jstck!

I *think* I am having the same problem with my printer,
since I moved it to the office, it does not work anymore...

My complaints:

- On some PC's the web page loads half, parts of packages seem to be missing.
- On some PC's the web page loads complete, but the buttons are not enabled.
- When I go back to Web interface version 0.90 the buttons are usually enabled.

I have tried to limit the number of connections from Firefox:

- Open the about:config page
- Search for network.http.max-connections
- Change the default value from 256 to 1

Loading the page takes longer, but on my PC's this does not fix anything.

I changed the maximum transmission unit (MTU) of my PC from 1300 to 1500,
this fixed the half page loading problem that I was having on multiple PC's!

Instructions: [my.bergersoft.net]

- Start regedit.exe
- HKLM\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
- Select the network interface that you are using
- Change the MTU key value to 1500
- Restart the PC to activate the change

Currently I am stuck at the "all buttons are disabled" problem when using recent web control versions confused smiley

Update: I think I am going crazy, the button problem has fixed itself, could not connect all day, and now I can...

Edited 2 time(s). Last edit at 09/01/2014 08:31AM by 3D-ES.


RS-Online Ormerod #263, Kossel mini with Minitronics, Prusa i3 MK2
Re: Web browser not being able to load UI, and using a web proxy to fix it
September 01, 2014 09:36AM
All my problems disappeared after some fw / web ui upgrade, but I'm not quite sure which one. Haven't seen that issue in a while. I used the proxy a couple of times when I was trying some web ui hacks (much easier to edit on a server than uploading files to the Duet).

Which FW/web ui version are you on? Do you get any error messages in the browser console?

Fiddling with MTU (changing it from anything other than 1500) is probably not the right way to go about it. Unless you change the MTU on every device on the local network, you will most likely cause problems and probably not solve anything. If you had it at 1300 before, that would probably explain a lot of things breaking (potentially any response from the Duet larger than 1300 bytes). Those instructions are a bit misleading, if you need to change MTU because of a tunnel/dialup/vpn link, you should only change it on that specific interface, not the local ethernet interface.
Re: Web browser not being able to load UI, and using a web proxy to fix it
September 01, 2014 09:45AM
zombiepantslol reported a problem loading the latest web interface, and resolved it by increasing the number of TCP PCBs in the firmware. So I have just added a 0.78r-alpha binary containing this change (and one other small change) to my github repository at [github.com]. You may wish to try it to see if it helps.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Web browser not being able to load UI, and using a web proxy to fix it
September 02, 2014 09:18AM
Thank you both for your feedback and warnings!

- The button problem is solved by following dc42's advice.
- My communication problems were not related to this thread.
- I restored the MTU settings on PC's that don't need to connect.

I can finally use the printer from the PC next to it smiling smiley


RS-Online Ormerod #263, Kossel mini with Minitronics, Prusa i3 MK2
Sorry, only registered users may post in this forum.

Click here to login