Skip to content

Commit e9b8558

Browse files
committed
Add X-Proxy-Curl-Error to failed requests
1 parent f804b5a commit e9b8558

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

proxy.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* @param zlib
77
*/
88

9-
10-
119
// Get normalized headers and such
1210
$headers = array_change_key_case(getallheaders());
1311
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
@@ -158,8 +156,9 @@
158156
function failure(int $status, $text)
159157
{
160158
if(is_resource($text))
161-
$text = curl_error($text);
159+
$text = sprintf('[%s] %s', curl_errno($text), curl_error($text));
162160
http_response_code($status);
161+
header("X-Proxy-Curl-Error: $text");
163162
exit($text);
164163
}
165164

0 commit comments

Comments
 (0)