Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can't do HTTP Requests to localhost? [closed]

Asked by
gskw 1046 Moderation Voter
10 years ago

So basically I can't do any HTTP Requests to http://localhost. It displays the following error:

19:49:52.142 - http://localhost/robloxalt/getsid?auth=&pid=0: HttpSendRequest, err=0x2EFD
19:49:52.143 - Script 'Workspace.HttpScript', Line 49 - global HttpReq
19:49:52.144 - Script 'Workspace.HttpScript', Line 114
19:49:52.144 - Stack End

My code is as following:

function HttpReq(address)
    printConsole("Log", "Doing request: "..address)
    local rep=game.HttpService:GetAsync(address)
    printConsole("Log", "Got reply: "..rep)
    return rep
end
local sid=HttpReq("http://"..url.."/getsid?auth=".._G.SettingsModule.AuthCode.."&pid="..pid)

However, I can easily do HTTP Requests to my public server.

EDIT: I forgot my web server listens to the port 8080. So I changed my first line to this:

local url = "localhost:8080/robloxalt"

Now it shows the following error:

20:01:58.948 - Not Found
20:01:58.948 - Script 'Workspace.HttpScript', Line 49 - global HttpReq
20:01:58.948 - Script 'Workspace.HttpScript', Line 114
20:01:58.948 - Stack End

Is this a 404 error? The file I'm requesting should be there...

EDIT 2: See my answer below.

Locked by evaera

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
gskw 1046 Moderation Voter
10 years ago

I forgot my server requires me to put the extension to the end of my file name, which my public server doesn't. I fixed it with changing the last line to this:

local sid=HttpReq("http://"..url.."/getsid.php?auth=".._G.SettingsModule.AuthCode.."&pid="..pid)
Ad