Skip to content

Commit 26bcec3

Browse files
authored
Edge redirect function enhancements (#410)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Chores** * Updated domain configuration for URL redirect routing * Refined slug mapping logic to handle single-part hostnames * **Tests** * Added comprehensive test coverage for redirect functionality, including edge cases, fallback behavior, path handling, and cache control validation <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent c5760df commit 26bcec3

File tree

2 files changed

+482
-3
lines changed

2 files changed

+482
-3
lines changed

src/linkryEdgeFunction/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ const DYNAMODB_TABLE = "infra-core-api-linkry";
1515
const FALLBACK_URL = process.env.FALLBACK_URL || "https://acm.illinois.edu/404";
1616
const DEFAULT_URL = process.env.DEFAULT_URL || "https://www.acm.illinois.edu";
1717
const CACHE_TTL = "30"; // seconds to hold response in PoP
18-
const BASE_DOMAINS = [".acm.illinois.edu", ".aws.qa.acmuiuc.org", ".acm.gg"];
18+
const BASE_DOMAINS = [
19+
".go.acm.illinois.edu",
20+
".go.aws.qa.acmuiuc.org",
21+
".acm.gg",
22+
];
1923

2024
const entries = Object.entries(Organizations);
2125
const shortToOrgCodeMapper: Record<string, string> = {};
@@ -37,8 +41,7 @@ function getSlugToQuery(path: string, host: string): string {
3741
}
3842

3943
const hostParts = cleanedHost.split(".");
40-
41-
if (hostParts.length > 1 && host !== "acm") {
44+
if (hostParts.length === 1 && host !== "acm") {
4245
const short = hostParts[0];
4346
if (shortToOrgCodeMapper[short]) {
4447
return `${shortToOrgCodeMapper[short]}#${path}`.replace("A01#", "");

0 commit comments

Comments
 (0)