Localhost blocked

I am connecting locally run Snap! to http://localhost:8888/ via URL block and the block always returns a null string after a wait.
I'm new to Snap! but a software engineer. I'm writing the server end as well.

I am seeing similar behavior from the apache server running on localhost on 80

calls to http://httpbin.org/robots.txt return the robots.txt file normally.

calls to my server from curl and firefox return the content normally

Do I need to do something to tell local Snap! to accept from a high local port?

Hmm, usually when people can't connect with the URL block it's a CORS issue, but that shouldn't be the case with localhost.

Do you start your local Snap! via HTTP or HTTPS? Maybe you need to use https://localhost:8888/ ?

It's loaded from a file: URL
file:///home/anniepoo/playingwithprolog/cookingwithsnap/Snap-5.1.0/snap.html#

just loaded into firefox.

Definitely https://localhost:8888/ won't work, as the SWI-Prolog server isn't terminating TLS.

I get the same behavior when I load snap by serving it through Apache, and across browsers

thanks - found issue. I wasn't serving the CORS header from the server

Yay, I'm glad this got resolved. Come to think of it, CORS really sucks :frowning:

"Come to think of it"? This isn't exactly news! :~/

Only some comments...

  • You can do it servin CORS header from your server, but if you are in localhost you can do other things.

  • To be in the same domain, you must load your Snap! from a webserver (not file://). And same domain really means same domain and same port. So, if your test is in localhost:8888, then your Snap! must also be inside 8888.

  • You also can use a proxy, and then, using official Snap! i possible.
    corsHttp

  • And also, you can use some "Snap! distros" like Snap4Arduino, to avoid this cors problem.

Joan