Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Windows Tipps & SecurityGetting Repeated No Caller ID Calls? Here’s What’s Really Going On(22.09.2026 um 22:31 Uhr)
Windows Tipps & SecurityHöllenmaschine: Gaming-Peripherie für gut 1.800 Euro für die HMX 6(23.09.2026 um 10:20 Uhr)
Windows Tipps & SecurityDas nächste große Ding: KI-Agenten(23.09.2026 um 10:30 Uhr)
Sichere ProgrammierungHow AI Is Making Restaurant Menus Easier to Navigate(23.09.2026 um 10:55 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Cloudfront Functions, WAF

Today we gonna to explain a particulary scenario in which the main idea is allow only specific ip address to reach a web site exposed using cloudfront. this is the architecture Before to start we need to explain differents resources…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Today we gonna to explain a particulary scenario in which the main idea is allow only specific ip address to reach a web site exposed using cloudfront.



this is the architecture





Before to start we need to explain differents resources inside aws



Simple Storage Service or S3 (buckets)

Is the most use service for object storage, you can save here any kind of file.



Cloudfront

Is the CDN or Content Delivery Network in AWS, this allows to that users around the globe use your web applications or apis in a faster and reliable way because the concept of CDN is to offer cache in the most near point of presence of aws, for example assume that you have clients in Europe and your application is hosted in Virginia, when you use cloudfront you application take less time to load at the final user than if you haven't this services.



Cloudfront functions

Is an improve options to allow deploy differents features to our sites, for example if you want to fix vulnerabilities related to HSTS in your sites you can use specific function to add this headers to our sites, or for example like this case if you want to allow only few ip address to reach your site and block the rest of the internet you can use specific functions to this.



WAF

Web Application Firewall native in AWS is the layer 7 security feature to protect our api web apps and others, this works with ALB, API gateway, Cloudfront and others resources inside AWS.



The common architecture for deploying statics sites in aws is using the architecture S3 bucket to public the site and integrate that with Cloudfront



To secure this architecture is important to never expose the bucket s3 to internet directly and that is the reason of using cloudfront.



You can configure this at origin option in cloudfront and copy the policy to the bucket s3 that has your web site





copy the policy OAC to the s3 bucket





In the s3 bucket you have this enable for S3 static website hosting





when you try to reach the url show a error message this is because the OAC configuration.





another security configuration is this one "Block public access" this is a must.





so once you have your application working using cloudfront + S3 now we explain the scenario.



Some X company wants to only allow a specific ip from a VPN services to reach the site exposed in cloudfront.



for doing this you can use WAF or cloudfront functions



In waf you can configure custom rules one for allow the specific ip address and then at default action you can put as block.



the expected behavior is that when you use the vpn the site loads correctly and without show a 403 error.



the whitelist rule is this





the default block is here





when I did the test show error whitout the vpn





and with the vpn works fine the site





be aware if you have some custom error pages at the cloudfront configuration because this can cause issues





Finally I check in waf console and see some blocks and some allow traffic





the other option is using cloudfronts functions



you need to create a function and associate with the cloudfront distribution





this is the function code




function handler(event) {
var request = event.request;
var clientIP = event.viewer.ip;

// Tu IP de VPN (puedes agregar múltiples)
var allowedIPs = [
'45.45.45.45'
];

// Verificar si la IP está permitida
if (allowedIPs.indexOf(clientIP) === -1) {
// IP no permitida - retornar 403
return {
statusCode: 403,
statusDescription: 'Forbidden',
headers: {
'content-type': { value: 'text/html; charset=utf-8' },
'cache-control': { value: 'no-store' }
},
body: {
encoding: 'text',
data: '<html><head><title>Access Denied</title></head><body><h1>403 - Access Denied</h1><p>VPN connection required to access this resource.</p></body></html>'
}
};
}

// IP permitida - continuar normalmente
return request;
}






then you need to publish your function and associated with the distribution





finally do some test and works similar to aws WAF.



without vpn





with vpn





I hope that this help



to the next time.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Cloudfront Functions, WAF

Thematisch verwandte Begriffe: Cloudfront, Functions · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick