Skip to content

clowa/lambda-golang-redirect

Repository files navigation

lambda-golang-redirect

Lightweight Configurable Lambda Redirection Service

Manage redirects using AWS Lambda functions.

Requirements

Installation

lambda-golang-redirect has a heavy dependency set listed above.

Once dependencies are met installation is a simple command:

```bash
$ make deploy
```

This will build the Go binaries and deploy everything to AWS Lambda.

Usage

  1. Run yarn install to download dependencies.

  2. Change provider configuration of serverless.yaml as needed.

    provider:
      name: aws
      runtime: go1.x
      region: eu-central-1
      architecture: arm64
      memorySize: 128
      stage: prod
      # Function environment variables
      environment:
        REDIRECT_TO: https://example.org # Change me
        HSTS_ENABLED: false
      # Duration for CloudWatch log retention (default: forever)
      logRetentionInDays: 7
      stackTags:
        app: ${self:service}
        stage: ${self:provider.stage}
        deploymentMethod: serverless
        repository: clowa/lambda-golang-redirect
    
    custom:
      domains:
        # References to 'prod' stage
        prod:
          domainName: clowa.de # Change me
          certificateName: clowa.de # Change me
    
      customCertificate:
        # Route 53 Hosted Zone name
        # don't forget the dot on the end!
        hostedZoneNames: "clowa.de." # Change me
  3. Run make deploy

Environment variables

Variable Default Description
REDIRECT_TO https://example.org URI of the redirect target
HSTS_ENABLED true Wether or not Strict-Transport-Security should be enabled
HSTS_MAX_AGE 300 * 24 * 60 * 60 300 days The time, in seconds, that the browser should remember that a site is only to be accessed using HTTPS.
HSTS_INCLUDE_SUBDOMAINS false If this parameter is true, this rule applies to all of the site's subdomains as well.
HSTS_PRELOAD false See Preloading Strict Transport Security for details. Not part of the specification.

Deployment

// todo

License

MIT

About

Lightweight Configurable Lambda Redirection Service in GoLang

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •