In production when I try to connect to my socket client in sails at 'https://something.com/api/' from the client url 'https://something.com/' I get a 404
https://something.com/socket.io/?__sails_io_sdk_version=0.13…owser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=LFGJG5g 404 (Not Found)
When I establish a socket connection in sails on my local machine it works.
My Local Configuration.
CLIENT HOST
http://localhost:8080/
API HOST
http://localhost:1337/
HTML
<script src="sails.io.js" autoConnect="false"></script>
JS
connect() {
this.socket = io.sails.connect('http://localhost:1337');// Works Fine
}
My Production Configuration
CLIENT HOST
https://something.com/
API HOST
https://something.com/api/
JS
connect() {
this.socket = io.sails.connect('https://something.com/api/');// Does not work
}
I made sure that autoConnect was defiantly set to false and that the only connection was happening via the connect() function. It seems that no matter what string I pass into the connect() function ( only in production ), it assumes the client url (https://something.com/) and drops the suffix /api/ from the production url (https://something.com/api/).