I like working with Node.js and making APIs. But recently, I’ve run into this problem where half the requests I send aren’t ever reaching any of my servers. For instance, I have this small project I’m working on right now. When I test my game in Studio or in-game, my request never goes through for some reason. When I check Server HTTP Requests in Developer Console, I find this:
This isn’t the only instance of this happening. I’ve done work for two different groups, one of which I made a place that has a script that fires a request to the web server as soon as someone joins the game. Half the time I join the game, none of my HTTP Requests work, including that one. I have to rejoin a couple of times to get a different server so it can work.
I have both endpoints on my Koa API router. However, I’m just using the GET at the moment. The problem isn’t with that because it works half the time and regardless of where I’m targetting, the morgan middleware catches it all requests sent on the port.
Perhaps you should use the new Http RequestAsync to get headers, etc. see if they return information that could be helpful. Also the output of the request, perhaps the router isnt picking it up for some reason http://robloxdev.com/api-reference/function/HttpService/RequestAsync
do you know what the body of the requests are returning?
in express it should have like “Cannot get /announcements”, it might help if it returns that, you could do a
simple catch all function on express like so, this will make 100% sure you are not getting the requests at all
app.use(function(req,res,next){
console.log(req.originalUrl + " was called")
next()
});
I’m using Koa which is kind of Express v5. The morgan middleware informs me of all hits that happen. So if I were to GET /nonexistentendpoint and /nonexistentendpoint is not routed anywhere, it would tell me that there was a GET request and it gave a 404. I am 100% sure that the requests aren’t coming at all.
No, the last batch of announcements were received and it worked. However, when I tried to get them again, the request never hit the server. It just showed that in the console.
Ahh i see, where are you hosting it? if at home, just note that ISPs dont like people hosting websites on residential connections (if that’s what you’re doing). I’ve experienced this in the past with my ISP
You’re also using HTTP and not HTTPS correct? i see in the images in the OP it says HTTP, just want to make sure though.
Let’s not tell my ISP what I’m doing . It’s not a permanent thing, just temporary while I make my thing work so I don’t have to constantly re-upload the file back up to my VPS every time I make a change. However this can’t be the problem because it also happens to my other stuff which are on my VPS.
local response = HTTPService:RequestAsync({ Url = 'http://hahaha.net:3333/announcements' });
for a,b in pairs (response) do
if (type(b) == "table") then
for c,d in pairs (b) do
print(c, d);
end;
end;
print(a, b);
end;
-- Inspect the response table
if response.Success then
print("Status code: " .. response.StatusCode .. " " .. response.StatusMessage)
print("Response body:\n" .. response.Body)
else
print("The request failed: " .. response.StatusCode .. " " .. response.StatusMessage)
end
data = response.Body;
I see, well you can setup a reverse proxy on apache (not sure the config as I use Nginx personally), but it’d allow you to use multiple domains on virtual hosts, so when making requests with domain hahahaha.net it’ll automatically route to your node app, that’s what I do for my production APIs via expressjs
Not entirely sure if using ports other than 80/443 would be the issue, if it is, then it’s entirely roblox’s fault, or it’s got to be. No reason why it shouldn’t connect. I also tested some code myself to random non-existant domains, and the error codes are not super helpful (like telling you whether its a DNS error, connection refused, etc.)
I don’t think I need a reverse proxy. I don’t use multiple domains either, I just create/remove subdomains with Cloudflare.
I’m using No-IP right now to map a free domain to my public IP with a port forward on port 3333. It does seem like Roblox’s fault because no matter how many times I spam my API with Postman or my browser, it always resolves and gives me a response.
Reverse proxy just makes it so you can use multiple domains on the same port, but if you dont want to, do what you want i guess
It could entirely be a DNS resolve issue on roblox’s side, or even the DNS provider is limiting how much they can do it (as far as i know, roblox doesnt cache DNS based on my experience), so try using a direct ip to the host so like http://192.168.2.1/example and see if the issue continues