Roblox - HTTPS SERVICE - 403 IN GAME // NOT IN STUDIO?

I have a system to send an API request outside of roblox upon interacting with a board and putting a message in however, this works in studio no errors. Perfectly.

Ingame I get http error 403… and it has no other errors. I was wondering if anyone knows a fix.

Servers have been restarted 10+ times and multiple different people have tried to use the feature.

Thanks in advance.

#api #WeirdAPILogic

READ THE COMMENTS BELOW BEFORE COMMENTING! TO TRY TO HELP THANKS.

1 Like

Are you by chance sending this request to Discord? If so you will need to use a proxy for it to work outside studio.

No I am sending the requests to a VPS of mine hosting a proxy like project that handles requests.

Try:

1 Like

Are you sure that the VPS allows requests from all IP addresses and not only your IP?

Yes, the same vps hosts a 2nd project and that project is working just fine with requets from the same game.

The error still remains.

image

When you playtest your game in Studio, HttpService sends requests from your IP address. When you play a game normally (through the client), the IP used is the one that belongs to the Roblox server hosting your game. If your VPS depends on checking IPs, you might need to white-list requests coming from Roblox.

My VPS accepts requests from anywhere also same thing as I said above applies, my other project works just fine its just the requests to this one port that keeps saying no.

I have used an application called POSTMAN to test it also and it works fine.

Have you tried checking whether it’s something on your side that’s blocking the request, or are you sure that it’s Roblox’s fault?

I am 99.9% sure sure it is roblox, I have tried go on a vps and using and send a request and it worked, its just roblox doesnt seem to be sending the request at all to the server.

-Kieranl29

Did you even publish the game? Or did you enable http enabled in your studio settings?

Yes. I have done both.

-Kieranl29

I can’t help because I don’t know how your API works. To understand, you are sending to the VPS?

1 Like

I have:

  1. A NODEJS bot on my VPS that also hosts an API [Web Request Listener]
  2. This is on port 1000
  3. I am sending requests to this from roblox studio and it works, from ingame it doesnt (I GET 403)

image

HTTP REQUESTS TO PORT 3000 WORK PERFECT TO THE SAME IP FOR ANOTHER BOT THAT IS RUNNING.

image

CODE:

local event = game.ReplicatedStorage.Events.SendToAPI
local http = game:GetService("HttpService")

local function sendContact(plr, ver, json, url)	
	print("trying to send!")
	print(json)
	local suc, err = pcall(function()
		return http:PostAsync("http://[IP]:1000/contact",json)
	end)
	print("sent.... ")
	print(suc, err)
	if suc then
		print('Success! HTTP Sent')
		game.ReplicatedStorage.Events.Notif:FireClient(plr, "Sucesss", "Sent message to kieranl29!", 3, true, Color3.fromRGB(74, 221, 108))
	elseif err then
		warn('HTTP Error: ' .. err)
	end
end

local function sendVerify(plr, ver, json)
	local suc, err = pcall(function()
		return http:PostAsync("http://[IP]:1000/verifyuser",json)
	end)
	print("sent verify")
	print(suc, err)
	print("verify sent.")
	if suc or err then
		if err == "Unable to DM user" then
			return game.ReplicatedStorage.Events.Notif:FireClient(plr, "ERROR!", "We are unable to dm you, Please enable your dm's! \n Ensure you are in our discord server!", 5, true, Color3.fromRGB(255, 0, 0))
		end
		if suc then
			--print('Success! HTTP Sent')
			return game.ReplicatedStorage.Events.Notif:FireClient(plr, "Sucesss", "Please check your DMS for further steps!!", 3, true, Color3.fromRGB(74, 221, 108))
		end

	elseif err then
		warn('HTTP Error: ' .. err)
		game.ReplicatedStorage.Events.Notif:FireClient(plr, "Error", err, 3, true, Color3.fromRGB(255, 0, 0))

	end	
end
event.OnServerEvent:Connect(function(plr, ver, json, url)
	if ver == "VERIFY" then
		sendVerify(plr, ver, json)
		print("SENDING VERIFY FUNCTION")
	else
		sendContact(plr, ver, json, url)
	end

end)

1 Like

That’s the culprit.


(Source: HttpService | Documentation - Roblox Creator Hub)
You need to use a port higher than 1024 (except 1194).

1 Like

@vopwn55 has been awared with :medal_military: the medal of not being me and checking for blocked ports (stupid design roblox good work)

Fix:

  1. Dont use port 1000, or 1194 or anything below 1024 (EXEPT 80, 443)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.