export default { async fetch(request, env) { const url = new URL(request.url); // --- ZETA CLOAKING CONFIG --- const TARGET_CORE = "https://pundiuang369-zeta-sovereign-core.hf.space"; // --- CORS OBLITERATION --- const corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': '*', }; if (request.method === 'OPTIONS') { return new Response(null, { headers: corsHeaders }); } // --- STEALTH PROXY ENGINE --- // Redirecting all traffic to the Hugging Face Space while masking the URL const proxyUrl = new URL(url.pathname + url.search, TARGET_CORE); const modifiedRequest = new Request(proxyUrl, { method: request.method, headers: request.headers, body: request.body, redirect: 'follow' }); try { const response = await fetch(modifiedRequest); // Create a new response so we can modify the headers const newResponse = new Response(response.body, response); // Inject CORS for global accessibility Object.keys(corsHeaders).forEach(key => { newResponse.headers.set(key, corsHeaders[key]); }); // Masking Server Headers for additional stealth newResponse.headers.set('Server', 'ZETA-GATEWAY/5.0 (Stealth)'); newResponse.headers.delete('X-Powered-By'); return newResponse; } catch (err) { return new Response(`[CRITICAL_FAILURE] Zeta Stealth Gateway collapsed: ${err.message}`, { status: 500, headers: { 'Content-Type': 'text/plain' } }); } } };