BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Amazon DOP-C02 Exam - Topic 4 Question 70 Discussion

Posted by Alexis on Oct 18, 2026 at 08:13 PM

A company deployed an Amazon CloudFront distribution that accepts requests and routes to an Amazon API Gateway HTTP API. During a recent security audit, the company discovered that requests from the internet could reach the HTTP API without using the CloudFront distribution.

A DevOps engineer must ensure that connections to the HTTP API use the CloudFront distribution.

Which solution will meet these requirements?

Suggested Answer: D

To restrict direct access to API Gateway, add a custom header in the CloudFront distribution origin request and use a Lambda authorizer in API Gateway to validate that header. Only requests routed through CloudFront will include this header. This is the AWS-recommended pattern in ''Secure your APIs behind CloudFront using custom headers and Lambda authorizers.''


Get Premium DOP-C02 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
26 comments · newest first
CH
Chiara Petit 10 days ago
I think D is correct because the tricky part is enforcing a custom header.
NA
Nasrin Ali 26 days ago
Looks like B here because a WAF in front of CloudFront doesn't enforce the custom header check at API Gateway.
MI
Minhee Yoon 3 days ago
↳ replying to Nasrin Ali
Custom header from the edge distribution verified by a function authorizer is key because WAF won't enforce header presence at the API.
TA
Tao Watanabe 4 days ago
↳ replying to Nasrin Ali
Use an authorizer to validate the custom header at the API layer so only requests that went through the edge distribution pass.
VI
Vikram Sinha 1 month ago
Pretty sure it is D because the tricky part is enforcing access via a custom header and a Lambda authorizer.
SU
Sumayya Jamil 7 days ago
↳ replying to Vikram Sinha
B won't fix it because traffic can still reach the API directly, bypassing the edge distribution.
AD
Aditya Bhat 7 days ago
↳ replying to Vikram Sinha
I got D as well after rereading the scenario.
YU
Yuki Chen 25 days ago
↳ replying to Vikram Sinha
It also blocks direct API access by requiring the header to be present, simplifying enforcement across teams.
DI
Dina Ahmed 20 days ago
↳ replying to Yuki Chen
I was unsure at first and nearly chose B, but the custom header with a Lambda authorizer finally made sense.
FA
Fatima Mirza 4 days ago
↳ replying to Dina Ahmed
Agree, the custom header plus a Lambda authorizer is the crucial pattern to force API Gateway access through CloudFront.
AA
Aarav Rao 2 days ago
↳ replying to Fatima Mirza
Yes, leveraging the custom header and a Lambda authorizer indeed blocks direct access and enforces CloudFront routing to API Gateway.
HE
Henrik Martin 11 days ago
↳ replying to Dina Ahmed
Was torn between B and D at first; that origin header plus Lambda authorizer finally clarified enforcing CloudFront as the gate.
AN
Antoine Sidorov 8 days ago
↳ replying to Henrik Martin
I agree, the custom header with a Lambda authorizer clearly enforces CloudFront as the gate.
JE
Jessica Wilson 26 days ago
↳ replying to Vikram Sinha
Why would a custom header with a Lambda authorizer prevent direct API access, and why not B or C?
MA
Matthew Turner 14 days ago
↳ replying to Jessica Wilson
Direct internet requests won’t carry the CloudFront custom header, so the Lambda authorizer blocks direct access; B or C can’t enforce header-based gating.
SN
Sneha Reddy 4 days ago
↳ replying to Matthew Turner
Yes, because direct internet requests won’t carry the CloudFront custom header, the Lambda authorizer enforces header-based gating, which the other approaches can’t achieve.
AI
Aiko Yang 13 days ago
↳ replying to Matthew Turner
Agree with that; the subtle distinction is that the Lambda authorizer must validate the header at API Gateway, not rely solely on CloudFront.
RO
Rozella 3 days ago
VPC Flow Logs won't actually solve the problem, just monitor it.
EL
Eliseo 8 days ago
Definitely need to implement some kind of verification, so I agree with D.
LO
Lorrine 13 days ago
Wait, how did requests bypass CloudFront in the first place?
CO
Coral 18 days ago
I think option C is a simpler solution.
LE
Leila 23 days ago
Option D sounds like the best way to secure the API.
ZE
Zena 28 days ago
I feel like option B, using AWS WAF, might not directly solve the problem of routing through CloudFront. It could help with security, but it doesn't enforce the connection requirement.
CI
Ciara 1 month ago
I'm a bit confused about the difference between options C and D. Both seem to involve some sort of authentication, but I can't recall the specifics.
FR
Frederick 1 month ago
I think option D sounds familiar. We practiced using custom headers with Lambda authorizers in class, and it seems like a solid way to ensure requests go through CloudFront.
KE
Kenny 1 month ago
I remember studying how to restrict access to APIs using CloudFront, but I'm not entirely sure which option is the best for this scenario.
0/2000 characters

Save Cancel