Http Content-Length 411 Error

So I’m trying to send a http PUT, using the httpService:RequestAsync() function. Although it tells me that I need a content length. When I include this in the header (called [“Content-Length”] = 0) it tells me that I’m not allowed to use that header.

Is there any way to include the Content-Length? I’ve tried the same request from this website which worked fine.

Its working on the original website tho
Maybe they have blocked roblox from getting requests?

Have you tried fetching it yourself? (from your server not roblox)

JSONDecode may be what you’re looking for?

No idea if this would work with JSON, though give it a shot, it might work.

???
When I send a request It tells me I need to include Content-length in the header, but I can’t include it

It’s possible they have blocked HTTP requests from Roblox, as @Synitx said.

@Lxi099 Yeah roblox is blocked.

Fetching from my server

image
image

Fetching from Roblox

image

That error is from Roblox’s RequestAsync

Yeah, because that website blocked roblox from requesting to their API.

I am having the same issue as this, the website has nothing to do with this, remove Content-Length and it will work

Oh then using [Content-Length] is blocked by roblox itself.

If developers read the documentation before replying, there’d be less speculation about what’s going on here. See RequestAsync. Content-Length is determined by the Body and thus cannot be defined in your Headers. A very different error would be produced if the endpoint in question rejected Roblox’s User-Agent from making requests to its API.

3 Likes

For some reason I am receiving the 411 error page for missing content length, even if it should have been filled automatically

Did you try using Content-Length in the body instead? As mentioned in my post you linked

It didn’t work, I don’t know what else to try

Can you show your script by any chance?

function API.HttpRequest(Url, Method, Headers, Body)
    if Method == "POST" and not Body then Body = jsonEncode({	   }) end
	--print(Url, Method, Body)

	return game:GetService("HttpService"):RequestAsync({
		Url = Url,
		Method = Method or "GET",
		Headers = Headers,
		Body = Body,
	})
end


function API.Request(Path, Method, Headers, Body)
    --print("!"..#Body, Path,Method,Headers,Body)

    --Headers["Content-length"] = #Body

	local Data = API.HttpRequest(API.Config.Host .. Path, Method, Headers or { --.. ":" .. API.Config.Port
		Authentication = API.Config.Authentication,
	}, Body
).Body
    print(Data)
	return jsonDecode(Data)
end

Make sure to include Content-Length in the Body

It doesn’t do anything;;;;;;;;;;

Hmm still the same content length not allowed error?

The request needs a Content-Length in the Headers, not the body, usually it’s done automatically by Roblox, but for some reason it doesn’t accept the request, I already tried adding it to the body, obviously it does nothing