php - When im NOT on VPN -- Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at -
php - When im NOT on VPN -- Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at -
if vpn'd company network ssl external website (https://mysite.company.com) works fine node/socket.io
once log off vpn , access site, gives error below in browser console:
cross-origin request blocked: same origin policy disallows reading remote resource @ https://mysite.company.com:8080/socket.io/?eio=3&transport=polling& t=1415132537790-0. can fixed moving resource same domain or enabling cors.
i don't know why happens when i'm off vpn...there no requests other mysite.company.com ... have tried many different methods resolve researching known error....nothing has worked, i'm hoping can support...please!
i have in .htaccess file:
header set access-control-allow-origin "*" header set access-control-allow-methods "post, get, options, delete, put" header set access-control-max-age "1000" header set access-control-allow-headers "x-requested-with, content-type, origin, authorization, accept, client-security-token" options followsymlinks # added rewrite respond 200 success on every options request. rewriteengine on rewritecond %{request_method} options rewriterule ^(.*)$ $1 [r=200,l]
my client.php (html section) file:
<script src="/js/socket.io-1.1.0.js"></script> <script type="text/javascript"> var socket = io.connect('https://mysite.company.com:8080'); socket.on('notification', function(data) { alert(data.message); }); </script>
my nodeserver.js:
var connectionsarray = []; //var app = require('express')(); var https = require('https'); var fs = require('fs'); var options = { key: fs.readfilesync('c:/certs/mysite_company_com.key'), cert: fs.readfilesync('c:/certs/star_company_com.crt'), ca: fs.readfilesync('c:/certs/digicertca.crt'), requestcert: true, rejectunauthorized: false }; var server = https.createserver(options); var io = require('socket.io').listen(server); server.listen(8080, 'mysite.company.com'); io.set('origins', '*:*');
php jquery node.js socket.io cross-domain
Comments
Post a Comment