Adding proxy script for bypassing ddev container during imports.

This commit is contained in:
dan612 2025-12-07 12:54:55 -05:00
parent 034dc92721
commit 41d8c16d84
2 changed files with 26 additions and 1 deletions

View File

@ -154,6 +154,7 @@
},
"scripts": {
"build-fe": "cd web/themes/custom/dchadwick && npm ci && npm run compile",
"deploy": "sh scripts/deploy.sh"
"deploy": "sh scripts/deploy.sh",
"start-proxy": "php -S 0.0.0.0:8888 proxy.php"
}
}

24
proxy.php Normal file
View File

@ -0,0 +1,24 @@
<?php
$url = $_GET['url'] ?? '';
if (empty($url)) {
http_response_code(400);
echo json_encode(['error' => 'No URL provided']);
exit;
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/vnd.api+json',
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0.1 Safari/605.1.15'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
http_response_code($httpCode);
header('Content-Type: application/vnd.api+json');
echo $response;