Skip to content

Commit

Permalink
Merge pull request #13549 from palant/nodeinfo-cors
Browse files Browse the repository at this point in the history
Allow CORS requests to nodeinfo endpoints
  • Loading branch information
MrPetovan authored Oct 16, 2023
2 parents ec61cda + ad729d4 commit 8c5794c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/BaseModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ public function run(ModuleHTTPException $httpException, array $request = []): Re
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
$this->response->setHeader(Router::GET, 'Access-Control-Allow-Methods');
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
} elseif (substr($this->args->getQueryString(), 0, 9) == 'nodeinfo/') {
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
$this->response->setHeader(Router::GET, 'Access-Control-Allow-Methods');
$this->response->setHeader('false', 'Access-Control-Allow-Credentials');
} elseif (substr($this->args->getQueryString(), 0, 8) == 'profile/') {
$this->response->setHeader('*', 'Access-Control-Allow-Origin');
$this->response->setHeader('*', 'Access-Control-Allow-Headers');
Expand Down

0 comments on commit 8c5794c

Please sign in to comment.