npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aligent/cdk-geoip-redirect

v1.2.5

Published

A Cloudfront Lambda@Edge stack for performing redirection based on CloudFront-Viewer-Country

Downloads

210

Readme

Geo-IP Redirect

TypeScript version AWS CDK version NPM version

Overview

This library provides a construct which creates a Lambda@Edge which is intended to be attached to the Origin Request in a CloudFront distribution. The construct allows a CloudFront website to perform GeoIP redirects to redirect users to a version of the website related to their location such as .com .com.au or .co.nz etc.

The Lambda@Edge function will check if the viewer's country code matches any supported regions. The user's country code for each request is pulled from the cloudfront-viewer-country. The construct will match the code to the record with the corresponding regex lookup.

Usage and Default Geo-IP Redirect options

redirectHost (string)

interface RedirectFunctionOptions {
	supportedRegions?:  Record<string, DomainOverwrite>;
	defaultRegionCode: string;
	defaultDomain: string;
}

| Property | Definition | | -------- | ---------- | | supportedRegions | A record with domain codes as a key (regex) and a domain to redirect to as a value | | defaultRegionCode | The default region code(s) as regex. These are the regions supported by defaultDomain. When multiple codes are used the default will be the first code the default site eg. ["AU","NZ"] will treat AU as the default | | defaultDomain | The website's main domain. This will act as a fallback for any unsupported regions | | enablePathRedirect | Will toggle adding a path suffix for a region such as .com/au or whether it should just be .com |

Using this package

The two main ways you can use this package are as follows: First off your website has a basic domain let's say www.aligent.com.au and you serve all content for all regions of the world here such as www.aligent.com.au/au or www.aligent.com.au/nz. For this approach you should use the below method

redirectBehaviourOptions: {
	defaultDomain: "www.aligent.com/au",
	defaultRegionCode: ["AU","NZ"],
}

Any region codes that are in the array like: ["XX","YY"] will automatically add the matching region as a path suffix to the url as lowercase.

However in order to redirect to a website that is different from the base domain such as www.aligent.co.nz you can "hardcode" a domain for a region to use by using the supportedRegions value.

redirectBehaviourOptions: {
	defaultDomain: "www.aligent.com",
	defaultRegionCode: "AU,US",
	supportedRegions: { "NZ": "www.aligent.co.nz" }
}

this package has not been tested with interplanetary domains