feat: add configurable HLS CORS allowlists
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plugin\AzuraCastOnDemandHls\Tests\Cors;
|
||||
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Plugin\AzuraCastOnDemandHls\Cors\NginxRules;
|
||||
|
||||
#[CoversClass(NginxRules::class)]
|
||||
final class NginxRulesTest extends TestCase
|
||||
{
|
||||
public function testItWritesExactOriginRulesForTheInternalHlsLocation(): void
|
||||
{
|
||||
self::assertSame(
|
||||
" set \$ondemand_hls_cors_origin \"\";\n"
|
||||
. " set \$ondemand_hls_cors_vary \"\";\n"
|
||||
. " if (\$http_origin != \"\") { set \$ondemand_hls_cors_vary \"Origin\"; }\n"
|
||||
. " if (\$http_origin = \"https://aifrequency.org\") { set \$ondemand_hls_cors_origin \$http_origin; }\n"
|
||||
. " if (\$http_origin = \"https://www.aifrequency.org\") { set \$ondemand_hls_cors_origin \$http_origin; }\n",
|
||||
NginxRules::forOrigins(['https://aifrequency.org', 'https://www.aifrequency.org'])
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user