-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9905c3
commit 8910c0f
Showing
1 changed file
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,46 @@ | ||
# replace this | ||
# CloudFrontRedirector-Construct | ||
|
||
CDK Construct to simplify using CloudFront to redirect entire domains or back-half stubs. | ||
|
||
## 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. | ||
|
||
<<< TODO: diagram >>> | ||
|
||
## Usage | ||
|
||
<<< TODO: Features >>> | ||
|
||
### Installation | ||
Before using this construct, you will need to import it for use in your AWS CDK stack. | ||
|
||
```bash | ||
# CDK for Typescript | ||
npm install @ssennettau/cdk-cloudfront-redirector | ||
``` | ||
|
||
### Integrating | ||
|
||
```typescript | ||
import * as cdk from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
import { RedirectionSite } from 'cdk-cloudfront-redirector'; | ||
|
||
export class DemoStack extends cdk.Stack { | ||
constructor(scope: Construct, id: string, props?: cdk.StackProps) { | ||
super(scope, id, props); | ||
|
||
const redirect = new RedirectionSite(this, "RedirectionForWebsite", { | ||
targetUrl: "https://ssennett.net/", | ||
}); | ||
|
||
// Return outputs | ||
new cdk.CfnOutput(this, "RedirectionUrl", { value: redirect.cfDistributionUrl }) | ||
} | ||
} | ||
``` | ||
|
||
## License | ||
|
||
All code in this project is licensed under the [MIT License](LICENSE). |