I have been over my apache configuration six ways to Sunday, and I know I am hitting everything that Frappe/Bench/ERPNext expects.
Current config (still testing, USER=frappe user, SITENAME=domain):
ProxyPreserveHost Off
ProxyAddHeaders Off
ProxyTimeout 120
ProxyPass "/.well-known/" "!"
ProxyPass "/AutoDiscover/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/files/" "!"
ProxyPass "/socket.io" "http://127.0.0.1:9000"
<Location "/socket.io">
RequestHeader set Upgrade "HTTP/1.1"
RequestHeader set Connection "Upgrade"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Origin "https://SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:9000"
</Location>
Alias "/assets" "/home/USER/frappe-bench/sites/assets"
<Directory /home/USER/frappe-bench/sites/assets>
Options FollowSymLinks
Require all granted
</Directory>
Alias "/files" "/home/USER/frappe-bench/sites/SITENAME/public/files"
<Directory /home/USER/frappe-bench/sites/SITENAME/public/files>
Options FollowSymLinks
Require all granted
</Directory>
ProxyPass "/" "http://127.0.0.1:8000/"
<Location "/">
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:8000/"
</Location>
#ProxyPassReverse "/socket.io/" "http://127.0.0.1:9000/"
#ProxyPassReverse "/" "http://127.0.0.1:8000/"
So I thought I’d take a look at the code. And I find this in /home/USER/frappe-bench/apps/frappe/socketio.js
early in the file as the first function called after http.listen
:
// test route
app.get('/', function(req, res){
res.sendfile('index.html');
});
Well now that matches the error I am getting, this file is not present in /home/USER/frappe-bench/apps/frappe/
. Now obviously I am not the one who designed this, but that just seems wrong to me. I would assume that these ajax calls to /socket.io are intended to return data presumably in json format, not simply send an index.html file (which happens to not exist).
Has anyone else checked the javascript console of a browser connected to a copy of the latest versions of Frappe/Bench/ERPNext? Do you see similar 404 errors?
edit: well I thought why not just give it what it wants? so I created a simple /home/frappe/frappe-bench/index.html
file:
<html>
<head></head>
<body>
<p>frappe-bench</p>
</body>
</html>
And the error is gone. But I am left wondering, is socketio.js really doing the job it was intended to do, or is it just sending an html file instead of actual polling data?
edit2: well I had a look, and sure enough, socketio.js is doing exactly that, just sending a simple html file, no actual data. and now that it is not hitting an error about the missing html file and retrying on an interval, the browser is calling for that “polling” data every few milliseconds and queueing up the requests, quickly saturating cpu usage on the client.
So after all this effort to get socketio/redis running, it is not actually doing anything! Wow.
It is starting to look to me like ERPNext is nowhere near ready for primetime.
edit 3: I’ll give it one more chance, and try commenting out the call to send index.html in socketio.js and see what I get.
edit 4: nope - no joy, commenting out that code bomb and restarting supervisord, the error that /socket.io spits out now is like Cannot GET /?EIO=3&transport=polling&t=1470083271385-2
. So it really is not doing anything useful at all.