© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3y ago•
1 reply
Yigal

Missing "Content-Length" from worker response

I'm setting a response with these headers:
const corsHeaders = new Headers({
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
    'Access-Control-Allow-Headers': 'Authorization, Content-Type',
    'Content-Type': 'application/json',
});
const corsHeaders = new Headers({
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
    'Access-Control-Allow-Headers': 'Authorization, Content-Type',
    'Content-Type': 'application/json',
});

But I get responses without "Content-Length". do I have to add it manually? is the existence of 'Content-Type': 'application/json' make it so the length isn't added?
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Get Content-Length
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
Customize Content-Length header
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3mo ago
Slow worker response
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
15mo ago
Can Cloudflare cache html response from worker?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago