0.0.73 • Published 2 days ago

cdk-cloudfront-redirector v0.0.73

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

CloudFrontRedirector-Construct

CDK Construct to simplify using CloudFront to redirect entire domains or back-half stubs. Published as cdk-cloudfront-redirector (NPM)

GitHub Release NPM Downloads

Concept

Needs to redirect domains or building custom link shorteners is a common pattern required by many different solutions. This project simplifies using Amazon CloudFront with CloudFront Functions to rewrite the requests, forwarding users to another location.

CloudFront Redirector Construct Diagram

Usage

This construct is able to either perform redirections for everything sent to a domain, or based on the back-half of the URL.

You might use this for something as simple as redirecting an unused www subdomain to a root apex, or for building your own link shortener service, similar to bit.ly.

For more details, check the auto-generated API.

Installation

Before using this construct, you will need to import it for use in your AWS CDK stack.

# CDK for Typescript
npm install cdk-cloudfront-redirector

Integrating

import { RedirectionSite } from 'cdk-cloudfront-redirector';

// Basic Setup
const redirectBasic = new RedirectionSite(this, "RedirectionForWebsite", {
    targetUrl: "https://ssennett.net/",
});

// Advanced Setup
const redirectAdvanced = new RedirectionSite(this, "RedirectionForWebsite", {
    targetUrl: "https://github.com/ssennettau/CloudFrontRedirector-Construct",
    pathRedirects: [
        path: "/author",
        destination: "https://ssennett.net/",
    ],
    customDomain: {
        domainName: "cfrc.cc",
        hostedZone: "cfrc.cc",
    }
});

// Return outputs
new cdk.CfnOutput(this, "RedirectionUrl", { value: redirectAdvanced.cfDistributionUrl });

License

All code in this project is licensed under the MIT License.

0.0.73

2 days ago

0.0.72

3 days ago

0.0.71

4 days ago

0.0.70

5 days ago

0.0.68

7 days ago

0.0.69

6 days ago

0.0.67

8 days ago

0.0.66

9 days ago

0.0.65

10 days ago

0.0.64

11 days ago

0.0.63

12 days ago

0.0.62

13 days ago

0.0.61

14 days ago

0.0.60

15 days ago

0.0.59

16 days ago

0.0.58

17 days ago

0.0.57

18 days ago

0.0.56

19 days ago

0.0.55

20 days ago

0.0.54

21 days ago

0.0.53

22 days ago

0.0.52

23 days ago

0.0.51

24 days ago

0.0.50

24 days ago

0.0.48

27 days ago

0.0.49

26 days ago

0.0.47

28 days ago

0.0.45

30 days ago

0.0.46

29 days ago

0.0.44

1 month ago

0.0.43

1 month ago

0.0.42

1 month ago

0.0.40

1 month ago

0.0.41

1 month ago

0.0.39

1 month ago

0.0.38

1 month ago

0.0.37

1 month ago

0.0.36

1 month ago

0.0.35

1 month ago

0.0.34

1 month ago

0.0.33

1 month ago

0.0.32

1 month ago

0.0.31

2 months ago

0.0.30

2 months ago

0.0.29

2 months ago

0.0.28

2 months ago

0.0.27

2 months ago

0.0.26

2 months ago

0.0.25

2 months ago

0.0.24

2 months ago

0.0.22

2 months ago

0.0.23

2 months ago

0.0.21

2 months ago

0.0.20

2 months ago

0.0.18

2 months ago

0.0.19

2 months ago

0.0.17

2 months ago

0.0.16

2 months ago

0.0.15

2 months ago

0.0.14

2 months ago

0.0.13

2 months ago

0.0.12

2 months ago

0.0.10

2 months ago

0.0.11

2 months ago

0.0.9

2 months ago

0.0.8

2 months ago

0.0.7

2 months ago

0.0.6

2 months ago

0.0.5

2 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.0

3 months ago