24 lines
716 B
PHP
24 lines
716 B
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
it('generates secure asset URLs behind the production proxy', function () {
|
|
Route::get('/_test/trusted-proxy-asset-url', fn () => response()->json([
|
|
'url' => asset('build/assets/theme.css'),
|
|
]));
|
|
|
|
$this
|
|
->withServerVariables(['REMOTE_ADDR' => '10.0.0.2'])
|
|
->withHeaders([
|
|
'X-Forwarded-Host' => 'dailyapi.leonmorival.xyz',
|
|
'X-Forwarded-Port' => '443',
|
|
'X-Forwarded-Proto' => 'https',
|
|
])
|
|
->getJson('/_test/trusted-proxy-asset-url')
|
|
->assertOk()
|
|
->assertJsonPath(
|
|
'url',
|
|
'https://dailyapi.leonmorival.xyz/build/assets/theme.css',
|
|
);
|
|
});
|