banner

KuchBhiLearning - A free website to learn and code

This is a good learning site. This contains details of cloud computing, AWS, AWS-CDK, AWS-SDK codes and examples including S3, Redis, lambda, api-gateway, cloudfront, cloudformation.

Add custom header in CloudFront/Pass custom header from Cloudfront

Add custom header in CloudFront/Pass custom header from Cloudfront.

Cloudfront has wide use cases and mostly used for hosting the websites.

But there are certain cases where we need to pass the custom header value, which means anything other than existing HTTP headers.

In this case we need to setup some configuration which we will show now.

For this we need to create a Origin Request Policy.

Head to Cloudfront > Policies > Origin Request Tab


There will be a button to create the origin request policy

Provide the required name and description and then in Headers dropdown select Include the following headers.


Then select Add custom button


This value should be same as the one which you will send as header name.

Create the origin request with the above configuration.

Validate the created origin request. Then let's associate this origin request to our distribution.

Navigate to Cloudfront > distribution > Behaviors tab > edit the behavior 


Then select the newly created behavior as below.

This was the last step we had to do and we are good to pass the custom header into our Cloud Front 👍.


No comments:

Post a Comment

If you have any doubts, Please let me know

Copyright 2022, KuchBhiLearning - A free website to learn and code. All rights Reserved.
| Designed by Yaseen Shariff