arrow_back
Back to Tickets
Edit Trouble Ticket
Update the ticket information below
Date Initiated
*
Status
*
Open
Pending
Completed
Terminated
Creator
*
Marcus
Priority
*
2
Urgent
Select urgency...
Urgent
Not Urgent
Important
Select importance...
Important
Not Important
Project Name
*
zfrika
Problem
*
fix the socketio for zfrikastaging and zfrika.com both of them can not tell who is online
Question
Root Cause
Notes
Strategy
Helpful People
Helpful Links
Diagram
Previous Steps
currently zfrikadev works for socketio but not staging and production. let's get staging to work before we get production to work. staging setup in nginx location /zfrikastaging/socket.io/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; #proxy_pass http://localhost:2004/socket.io; proxy_pass http://localhost:2004/zfrikastaging/socket.io/; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
Next Steps
update each user page that tracks user movement : post, profile messages your post home diaspora page for staging, production , development.
Solution
completed
Insight
tip 1: use the development tab. NETWORK tab and select socket.io.js . tip 2: Before refreshing your page, check if the file even exists at that URL. Open your browser and go directly to: https://zfrika.com/zfrikastaging/socket.io/socket.io.js tip3: he reason you are getting io is not defined is likely because of a trailing slash mismatch in your proxy_pass. When you use a path like /zfrikastaging/socket.io/ in Nginx, it is very sensitive to how the URL is passed to Node.js. If Nginx can't find the file, it returns an HTML error page instead of the JavaScript file. When the browser tries to read that HTML as JavaScript, it fails, and io never gets defined. 1. Fix the Nginx proxy_pass In Nginx, when you add a path at the end of proxy_pass, it changes how the URI is "mapped." To keep it simple and ensure the socket.io.js file is found, use the trailing slash consistently. Update your Nginx block to this: Nginx location /zfrikastaging/socket.io/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Notice the trailing slash at the end of both the location and the proxy_pass proxy_pass http://localhost:2004/socket.io/; }
Date Resolved
save
Update Ticket
Cancel