Skip to content
Snippets Groups Projects
Commit 370f2ab3 authored by Fredrik Fonn Hansen's avatar Fredrik Fonn Hansen :8ball:
Browse files

Merge branch 'backend-30-req' into 'main'

Backend 30 req

See merge request !61
parents 9b1da252 9690dd76
No related branches found
No related tags found
1 merge request!61Backend 30 req
Pipeline #215562 failed with stages
in 5 minutes and 36 seconds
......@@ -111,3 +111,25 @@ Backend (NTNU-VM):
only:
refs:
- main
VM Heartbeat:
stage: deploy
needs: [Backend (NTNU-VM)]
image: alpine
script:
- apk add --no-cache curl
- |
for i in {1..18}; do
sleep 10
response=$(curl --silent --write-out "%{http_code}" --connect-timeout 5 --max-time 10 http://10.212.26.72/server/heartbeat)
echo "Response: $response"
if [ "$response" -eq 200 ]; then
echo "Server is alive"
exit 0
fi
done
echo "Server did not respond with 200 OK after 3 minutes"
exit 1
only:
refs:
- main
......@@ -39,4 +39,4 @@ e2e tests: `yarn test`
## Restrictions
The backend will only allow 15 requests per minute from the same IP address. This is to prevent abuse of the API.
The backend will only allow 30 requests per minute from the same IP address. This is to prevent abuse of the API.
......@@ -3,7 +3,7 @@ const rateLimit = require('express-rate-limit');
// Configure rate limiter
export const rateLimiter = rateLimit({
windowMs: 60 * 1000, // 1 minute in milliseconds
max: 15, // Limit each IP to 1000 requests per windowMs
max: 30, // Limit each IP to 1000 requests per windowMs
statusCode: 429, // HTTP status code to send when rate limit is exceeded (Too Many Requests)
message: 'Too many requests, please try again later.',
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment