Skip to content

Commit

Permalink
Switch invalid URL response from 5xx to 400
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Dec 6, 2024
1 parent aef1e9e commit 0aa9ea2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/playground/php-cors-proxy/cors-proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@
echo "Bad Request\n\nNo URL provided";
exit;
}
$resolved = url_validate_and_resolve($targetUrl);

try {
$resolved = url_validate_and_resolve($targetUrl);
} catch (CorsProxyException $e) {
http_response_code(400);
echo "Bad Request\n\n" . $e->getMessage();
exit;
}

$host = $resolved['host'];
$resolvedIp = $resolved['ip'];

Expand Down

0 comments on commit 0aa9ea2

Please sign in to comment.