cdk-cloudfront-redirector v0.0.73
CloudFrontRedirector-Construct
CDK Construct to simplify using CloudFront to redirect entire domains or back-half stubs. Published as cdk-cloudfront-redirector
(NPM)
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.
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.
2 days ago
3 days ago
4 days ago
5 days ago
7 days ago
6 days ago
8 days ago
9 days ago
10 days ago
11 days ago
12 days ago
13 days ago
14 days ago
15 days ago
16 days ago
17 days ago
18 days ago
19 days ago
20 days ago
21 days ago
22 days ago
23 days ago
24 days ago
24 days ago
27 days ago
26 days ago
28 days ago
30 days ago
29 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago