Thank you, Tim. So I went to add that header and noticed I already had it, like this:
$.ajaxSetup({async:true, cache:false, timeout:9999,
dataType:‘text’, contentType:‘text/plain’, processData:false});
I then removed both dataType and contentType from the setup and it worked in that it didn’t cancel connection, but timed out after 10 seconds. Second request went fine as before.
I’m now waiting for glitch site to fall asleep and will try again, and maybe it will work, but I thought I should report what wappened so far in any case… second attempt timed out as well.
p23.glitch.me (sends request):
$.ajaxSetup({async:true, cache:false, timeout:9999, processData:false});
var appPath= 'https://pok.glitch.me';
$.ajax(
{
url:appPath +'/lod', type:'GET',
error:function(e, f)
{
adminInfo.innerText+= 'FAIL@client:'+ f +'\n';
},
success:function(r, s, x)
{
var d= r.replace(/\n|\r/g, '');
}
});
pok.glitch.me (serves response):
var ex= require('express'), ap= ex();
var wl= ['https://pokerica.github.io', 'https://p23.glitch.me'];
function sh(q,a)
{
var o= q.headers.origin;
if(wl.indexOf(o) < 0) { q.connection.destroy(); return; }
a.header({'Access-Control-Allow-Origin':o});
}
ap.get('/lod', function(q, a)
{
sh(q,a);
a.sendFile(__dirname + '/db.txt');
});