Skip to content

Commit 5b08dc4

Browse files
committed
FDWebServer: support COR
1 parent a6f8c1d commit 5b08dc4

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

FDWebServer/CGI/env.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ function loadModule(ModuleManager $manager, string $name){
5151
header("X-SimpleFramework: " . Framework::PROG_VERSION);
5252
FlashDetector::init("chs");
5353

54+
header("Access-Control-Allow-Origin: *");
55+
header("Access-Control-Allow-Headers: *");
5456
header("Content-Type: application/json");

FDWebServer/WorkerManEE/src/iTXTech/FlashDetector/WebServer/WebServer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function __construct(array $config){
4747
RequestHandler::registerPage("/info", InfoPage::class);
4848
$this->webServer = new WNWS("http://" . $config["address"] . ":" . $config["port"]);
4949
$this->webServer->onReceive = function (TcpConnection $connection){
50+
Http::header("Access-Control-Allow-Origin: *");
51+
Http::header("Access-Control-Allow-Headers: *");
5052
Http::header("Content-Type: application/json");
5153
Http::header("X-SimpleFramework: " . Framework::PROG_VERSION);
5254
Logger::info("Got request " . $_SERVER["REQUEST_URI"] . " from " . $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"]);

FDWebServer/swoole/src/iTXTech/SimpleSwFw/Http/Page/AbstractPage.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static function getClientIp(Request $request){
3333
}
3434

3535
public static function sendJsonData(Response $response, array $data){
36+
$response->header("Access-Control-Allow-Origin", "*");
37+
$response->header("Access-Control-Allow-Headers", "*");
3638
$response->header("Content-Type", "application/json");
3739
$response->end(json_encode($data));
3840
}

0 commit comments

Comments
 (0)