Skip to content

Instantly share code, notes, and snippets.

@jorovipe97
jorovipe97 / .htaccess
Created December 21, 2020 15:58
Redirect all trafic to temporal site except me
# This redirects all users except me to a temporal website.
# Inspired from: https://stackoverflow.com/questions/293285/want-to-redirect-all-visitors-except-for-me
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirect all except allowed IP
# The HTTP:X-Forwarded-For is used when the site is behind a proxy or load balancer like CloudFlare, AWS Application Load Balancer, etc.
# The used ip should be the public ip of your router, use a website like "whats my public ip" to know this.
# In the case your site isn't behind proxies or load balancer, replace "HTTP:X-Forwarded-For" to "REMOTE_ADDR"
@jorovipe97
jorovipe97 / lambdaUrlTimeout
Created April 15, 2022 17:07
A simple lambda function to test if we can invoke a lambda URL that takes more than 30 seconds
// This dummy function is just to answer the following simple question:
// Do these new AWS Lambda Function URLs still suffer the same timeout issues that the API Gateway does? Namely 30s?
// Answer: According to my local testing I found they dont suffer the 30s limitation, which is pretty amazing.
exports.handler = async (event) => {
console.log(event)
let timeoutSeconds = +event.queryStringParameters.timeout
if (typeof timeoutSeconds !== 'number') {
timeoutSeconds = 40