<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jay Dobariya</title>
    <description>The latest articles on DEV Community by Jay Dobariya (@jaydobariya98).</description>
    <link>https://dev.to/jaydobariya98</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1027944%2F1a9c3903-dbb9-4356-8a1d-e5f481fe903a.png</url>
      <title>DEV Community: Jay Dobariya</title>
      <link>https://dev.to/jaydobariya98</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaydobariya98"/>
    <language>en</language>
    <item>
      <title>Add Custom Header in Website using Lambda@Edge</title>
      <dc:creator>Jay Dobariya</dc:creator>
      <pubDate>Thu, 16 Feb 2023 10:00:22 +0000</pubDate>
      <link>https://dev.to/jaydobariya98/add-custom-header-in-website-using-lambdaedge-59ap</link>
      <guid>https://dev.to/jaydobariya98/add-custom-header-in-website-using-lambdaedge-59ap</guid>
      <description>&lt;p&gt;Lambda@Edge is a powerful serverless computing service provided by Amazon Web Services (AWS) that allows users to run custom code at the edge of the AWS global network, where their content is cached and served to users. With Lambda@Edge, users can add custom logic to their CloudFront distributions, such as modifying headers, redirecting requests, and manipulating requests and responses in real-time. In this blog, we will explore how to use Lambda@Edge with an example and code snippet.&lt;/p&gt;




&lt;p&gt;Example Use Case:&lt;/p&gt;

&lt;p&gt;Suppose you have a website hosted on S3 and served through CloudFront. You want to add a custom header to all requests that pass through CloudFront to track the source of the request. You can achieve this by creating a Lambda function and attaching it to your CloudFront distribution using Lambda@Edge.&lt;/p&gt;




&lt;p&gt;Step 1: Create a Lambda Function&lt;br&gt;
First, you need to create a Lambda function that adds the custom header to incoming requests. Here's a sample code snippet in Node.js:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;exports.handler = (event, context, callback) =&amp;gt; {&lt;br&gt;
    const request = event.Records[0].cf.request;&lt;br&gt;
    request.headers['X-Source'] = [{key: 'X-Source', value: 'CloudFront'}];&lt;br&gt;
    callback(null, request);&lt;br&gt;
};&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
This code adds the X-Source header to the incoming request with the value CloudFront.&lt;/p&gt;




&lt;p&gt;Step 2: Create a CloudFront Distribution&lt;br&gt;
Next, you need to create a CloudFront distribution for your S3 bucket. In the CloudFront console, create a new distribution and select the S3 bucket as the origin.&lt;/p&gt;




&lt;p&gt;Step 3: Add Lambda Function to CloudFront Distribution&lt;br&gt;
After you have created the CloudFront distribution, go to the Behaviors tab and select the default behavior. Under Lambda Function Associations, select "Origin Request" and choose the Lambda function that you created in Step 1.&lt;/p&gt;




&lt;p&gt;Step 4: Test the CloudFront Distribution&lt;br&gt;
Once the CloudFront distribution has been updated with the Lambda function, you can test it by accessing your website through the CloudFront domain name. Use the browser's developer tools to inspect the incoming request headers, and you should see the X-Source header with the value CloudFront.&lt;/p&gt;




&lt;p&gt;Conclusion:&lt;br&gt;
Lambda@Edge provides a powerful way to add custom logic to your CloudFront distributions, enabling you to modify requests and responses in real-time. In this example, we showed how to add a custom header to all incoming requests using a Lambda function. This is just one of the many ways you can use Lambda@Edge to enhance the functionality of your CloudFront distributions.&lt;/p&gt;

</description>
      <category>react</category>
      <category>ui</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>AWS CloudFront's Advance Usage</title>
      <dc:creator>Jay Dobariya</dc:creator>
      <pubDate>Thu, 16 Feb 2023 08:53:22 +0000</pubDate>
      <link>https://dev.to/jaydobariya98/aws-cloudfronts-advance-usage-31g2</link>
      <guid>https://dev.to/jaydobariya98/aws-cloudfronts-advance-usage-31g2</guid>
      <description>&lt;p&gt;CloudFront is a content delivery network (CDN) provided by Amazon Web Services (AWS) that is used to distribute content, such as web pages and video, to users across the globe with low latency and high data transfer speeds. While CloudFront has a wide variety of use cases, its advanced features provide additional functionality for specific needs. &lt;/p&gt;

&lt;p&gt;In this blog, we will explore CloudFront's advanced usage to provide an in-depth understanding of the service's capabilities.&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;Custom SSL Certificates
CloudFront allows users to upload their own SSL/TLS certificates for custom domain names. This is useful when the default CloudFront domain name does not meet the branding requirements or compliance policies of a particular company. With custom SSL certificates, users can secure their content using their own domain name, making it easier for users to trust the content they are accessing.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Lambda@Edge
Lambda@Edge is a serverless computing platform that allows users to run code on the CloudFront edge locations, where content is cached and served to users. With Lambda@Edge, users can add custom logic to their CloudFront distributions, such as rewriting URLs, modifying headers, and manipulating requests and responses in real time. This provides a powerful way to customize CloudFront behaviour based on the user's specific requirements.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Field-Level Encryption
Field-Level Encryption (FLE) is a CloudFront feature that adds an additional layer of security to sensitive data. FLE enables users to encrypt specific fields of data, such as credit card numbers, in HTTP(S) requests before they are sent to the origin server. This ensures that even if a malicious user gains access to the request payload, they will not be able to see sensitive data.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Signed Cookies
Signed Cookies are used to provide access control to content served by CloudFront. With Signed Cookies, users can restrict access to their content based on the user's authentication status, HTTP method, and even a specific time period. This is useful when users need to serve content to a select group of users, such as those who have a paid subscription.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Geo-Targeting
CloudFront offers Geo-Targeting capabilities that allow users to serve specific content based on the user's geographical location. This is useful for companies that want to provide localized content or promotions to users in specific regions. With CloudFront's Geo-Targeting feature, users can customize the content they serve to users in different parts of the world.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;Custom Error Pages
CloudFront allows users to create and serve custom error pages, making it easier to provide helpful error messages to users when something goes wrong. With custom error pages, users can brand the error pages to match their website's style, and provide more detailed error messages that are easier for users to understand.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;In conclusion, CloudFront is a powerful CDN service that offers advanced features to help users customize their content delivery to better suit their specific needs. With custom SSL certificates, Lambda@Edge, Field-Level Encryption, Signed Cookies, Geo-Targeting, and Custom Error Pages, users can take advantage of CloudFront's advanced features to provide an optimal content delivery experience to their users.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudfront</category>
      <category>cdn</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
