mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 10:46:43 +02:00
fix(activitypub): allow cors on get requests for routes exposing acitivitypub objects
This commit is contained in:
parent
412cf14604
commit
2f2480998f
6 changed files with 74 additions and 20 deletions
|
|
@ -10,21 +10,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\HTTP\Response;
|
||||
use Modules\Fediverse\Controllers\ActivityPubController as FediverseActivityPubController;
|
||||
|
||||
class ActivityPubController extends Controller
|
||||
class ActivityPubController extends FediverseActivityPubController
|
||||
{
|
||||
/**
|
||||
* @noRector ReturnTypeDeclarationRector
|
||||
*/
|
||||
public function preflight(): Response
|
||||
{
|
||||
return $this->response->setHeader('Access-Control-Allow-Origin', '*') // for allowing any domain, insecure
|
||||
->setHeader('Access-Control-Allow-Headers', '*') // for allowing any headers, insecure
|
||||
->setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS') // allows GET and OPTIONS methods only
|
||||
->setHeader('Access-Control-Max-Age', '86400')
|
||||
->setHeader('Cache-Control', 'public, max-age=86400')
|
||||
->setStatusCode(200);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue