᲼᲼᲼᲼
᲼᲼᲼᲼
Explore posts from servers
CDCloudflare Developers
Created by ᲼᲼᲼᲼ on 2/13/2025 in #general-help
Snippet API Issue (down?)
API Request Failed: PUT /api/v4/zones/493ab3fa5d780aa7653c8f028060642c/snippets/cors_yt (503) PUT answer: upstream connect error or disconnect/reset before headers. reset reason: connection termination Put Request (in which the config is going though):
------geckoformboundary7d56fe3f568fb424b753e5424761e3db
Content-Disposition: form-data; name="metadata"

{"compatibility_date":"2023-01-31","bindings":[],"main_module":"snippet.js"}
------geckoformboundary7d56fe3f568fb424b753e5424761e3db
Content-Disposition: form-data; name="snippet.js"; filename="snippet.js"
Content-Type: application/javascript+module

const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,POST,OPTIONS,HEAD,PATCH,PUT,DELETE",
"Access-Control-Allow-Headers": "User-Agent,Authorization,Content-Type",
"Access-Control-Allow-Credentials": "true",
"Cross-Origin-Resource-Policy": "cross-origin"
};

export default {
async fetch(request) {
// Handle preflight OPTIONS request
if (request.method === "OPTIONS") {
return new Response(null, {
status: 204,
headers: corsHeaders
});
}

try {
// Forward the request to your backend
const response = await fetch(request);

// Clone the response so we can modify headers
const newResponse = new Response(response.body, response);

// Add CORS headers to the response
Object.entries(corsHeaders).forEach(([key, value]) => {
newResponse.headers.set(key, value);
});

return newResponse;
} catch (error) {
return new Response(`Error: ${error.message}`, { status: 500 });
}
}
};
------geckoformboundary7d56fe3f568fb424b753e5424761e3db--
------geckoformboundary7d56fe3f568fb424b753e5424761e3db
Content-Disposition: form-data; name="metadata"

{"compatibility_date":"2023-01-31","bindings":[],"main_module":"snippet.js"}
------geckoformboundary7d56fe3f568fb424b753e5424761e3db
Content-Disposition: form-data; name="snippet.js"; filename="snippet.js"
Content-Type: application/javascript+module

const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,POST,OPTIONS,HEAD,PATCH,PUT,DELETE",
"Access-Control-Allow-Headers": "User-Agent,Authorization,Content-Type",
"Access-Control-Allow-Credentials": "true",
"Cross-Origin-Resource-Policy": "cross-origin"
};

export default {
async fetch(request) {
// Handle preflight OPTIONS request
if (request.method === "OPTIONS") {
return new Response(null, {
status: 204,
headers: corsHeaders
});
}

try {
// Forward the request to your backend
const response = await fetch(request);

// Clone the response so we can modify headers
const newResponse = new Response(response.body, response);

// Add CORS headers to the response
Object.entries(corsHeaders).forEach(([key, value]) => {
newResponse.headers.set(key, value);
});

return newResponse;
} catch (error) {
return new Response(`Error: ${error.message}`, { status: 500 });
}
}
};
------geckoformboundary7d56fe3f568fb424b753e5424761e3db--
3 replies
DHDistant Horizons
Created by ᲼᲼᲼᲼ on 3/30/2024 in #bug-report
travelling in elytra create wierd graphics effects
No description
6 replies
DHDistant Horizons
Created by ᲼᲼᲼᲼ on 3/30/2024 in #bug-report
what is going on here
No description
2 replies