Skip to content

Commit

Permalink
fix: resolve CORS cross-origin
Browse files Browse the repository at this point in the history
  • Loading branch information
gua committed Nov 15, 2023
1 parent 64d0e8f commit f51d7ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Middleware/CORS.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function handle($request, Closure $next)
}
}
$response = $next($request);
$response->header('Access-Control-Allow-Origin', str_replace('/', '', $origin));
$response->header('Access-Control-Allow-Origin', preg_replace('~(?:^/|/$)~', '', "/".$origin));
$response->header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS,HEAD');
$response->header('Access-Control-Allow-Headers', 'Origin,Content-Type,Accept,Authorization,X-Request-With');
$response->header('Access-Control-Allow-Credentials', 'true');
Expand Down

0 comments on commit f51d7ae

Please sign in to comment.