Page 1 of 1

SB and HTTPRequest

Posted: Tue Oct 24, 2017 6:38 am
by karu
How you guys solved HTTPRequest in development time. In development time i push run button on SB toolbar and code will be run on 127.0.0.1:9080. In this case i cant use HTTPRequest, because other address that 127.0.0.1:9080 will be cross domain and 127.0.0.1:9080 used by SB server? I need to communicate with php script.
Sorry, if my english is not clear enouhgt :)

Re: SB and HTTPRequest

Posted: Tue Oct 24, 2017 8:18 am
by SparrowhawkMMU
Hi Karu,

At the server end, you need to send an allow origin header. for example, in PHP, you need to include this with your response:

Code: Select all

header('Access-Control-Allow-Origin: *');
The * means any origin, ie any client anywhere - you can filter it to specific IP addresses if these are known and fixed.

Further reading: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Re: SB and HTTPRequest

Posted: Tue Oct 24, 2017 10:06 am
by karu
SparrowhawkMMU wrote:Hi Karu,

At the server end, you need to send an allow origin header. for example, in PHP, you need to include this with your response:

Code: Select all

header('Access-Control-Allow-Origin: *');
The * means any origin, ie any client anywhere - you can filter it to specific IP addresses if these are known and fixed.

Further reading: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
thanks but somehow i didnt understand, can you give me example please, thanks

Re: SB and HTTPRequest

Posted: Tue Oct 24, 2017 11:06 am
by karu
Now i succeed, thanks:
<?php
header("Access-Control-Allow-Origin: *");
?>

text to return