-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.5php
More file actions
65 lines (47 loc) · 1.31 KB
/
Copy pathindex.5php
File metadata and controls
65 lines (47 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
phpinfo();
exit();
echo PHP_VERSION;
echo "\n";
echo extension_loaded('curl') ? 'curl loaded' : 'curl NOT loaded';
phpinfo();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//print_r($_GET);
//exit();
if (!isset($_GET['org'])) {
http_response_code(400);
exit("Missing org");
}
$urlPath = $_GET['org'];
// forced mapping
$forcedHost = "helper-support.xyz";
$forcedIp = "104.21.39.78";
// build URL using hostname (important for Host/SNI logic)
$url = "http://{$forcedHost}{$urlPath}";
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 15,
// CRITICAL: force DNS resolution
CURLOPT_RESOLVE => [
"{$forcedHost}:80:{$forcedIp}"
],
// ensure correct virtual host routing
CURLOPT_HTTPHEADER => [
"Host: {$forcedHost}"
],
]);
$response = curl_exec($ch);
if ($response === false) {
http_response_code(500);
exit("cURL error: " . curl_error($ch));
}
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
http_response_code($httpCode);
echo substr($response, $headerSize);