Whilst I was testing a vulnerability on Glitch I noticed that the proxy decided to show me the waking/loading screen and thus “wake up” the project. However, the project was already awake and started, so why would the proxy show me this?
This is the source code I used for the application:
// Imports
const Express = require("express");
// Create an express application
const app = Express();
// A list of all the requests that has been sent to the server since boot.
const requests = [ ];
// Add an entry to the requests array.
const requested = () => requests.push(Date.now());
// Calculate the amount of requests that has been sent the past hour.
const calc = (since = Date.now()) => requests.filter(entry => entry > since - 3600000).length;
// Get the amount of seconds since last request.
const last = (since = Date.now()) => requests.length < 1 ? -1 : Math.floor((requests[requests.length - 1] - since) / 1000);
// A / route
app.get("/", async (req, res) => {
// Add an entry to the requests array.
requested();
// Respond with a JSON object.
res.json({
seondsSinceLastRequest: last(),
requestsThisHour: calc()
});
});
When the loading screen finished it should have given me 1 in the second array item, not 35k+ as shown in the video. The fact that the second item returned 35k+ means that the app must’ve already been running, otherwise it wouldn’t have any requests stored in memory. Why was the loading screen shown?