Fix Access-Control-Allow-Origin: * for get_data

Merged
#7 · Created  · Last updated

Merged pull request

Merged in lucaswerkmeister/pagepile/cors (pull request #7)

9f96709·Author: ·Closed by: ·2019-08-23

Description

The various outputData*() functions all control their own headers and output and then exit, so adding a header at the bottom of the script doesn't work when they are used (though it works for get_info, which doesn't use those functions and always returns JSON). Instead, let's set the header right before calling those functions. And to keep it simple, also directly set the header in the get_info handler, even though the $public / delayed header() approach works there.


Sorry for the broken pull request #5... it was pretty hard to debug this because I couldn't initially figure out how to run this tool anywhere else. I finally got it partially working on Toolforge (speed-patrolling tool, otherwise unused) with the following file:

tools.speed-patrolling@tools-sgebastion-07:~$ cat public_html/.user.ini include_path = '.:/data/project/magnustools/public_html:/usr/share/php'

However, for some reason that only fixes api.php, not index.php, and also I don't understand how the include_path is being set in the real pagepile tool, since I don't see any .user.ini file there.

0 attachments

0 comments

Loading commits...