Skip to content

FusionAuth/fusionauth-example-cloudfront-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

fusionauth-example-cloudfront-redirect

This example documents how to use a AWS CloudFront Function to redirect to country-specific URLs, such as a FusionAuth instance.

Setup

Create a CloudFront distribution

Create a CloudFront function

Test the function using the AWS CLI

  • Get the current version (ETAG) of the function

    aws cloudfront describe-function --name <function-name>
    
  • cloudfront-viewer-country header set to US

    aws cloudfront test-function --if-match <ETAG> --name <function-name> --event-object fileb://./test/country-us.json
    
  • cloudfront-viewer-country header set to GB

    aws cloudfront test-function --if-match <ETAG> --name <function-name> --event-object fileb://./test/country-gb.json
    

Associate the function with the distribution

Add the CloudFront-Viewer-Country header to each viewer request

Test the distribution

  • use the Distribution domain name or create an alternate domain name.

More

Amazon CloudFront Functions, https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html, is a serverless edge compute feature allowing you to run JavaScript code at 225+ Amazon CloudFront, https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html, edge locations for lightweight HTTP(S) transformations and maniupulations.

Writing function code, https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published