Skip to content

Commit

Permalink
Merge branch 'main' into lambda-v-140
Browse files Browse the repository at this point in the history
  • Loading branch information
rcantin-w committed Oct 31, 2024
2 parents eb08c9a + 4ce9606 commit 8a1c9bd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ updates:
- dependency-name: '@slicemachine'
# Needs more work, has its own ticket. Remove this once it's done.
- dependency-name: 'eslint*'
# Needs untangling, has its own ticket. Remove this once it's done.
- dependency-name: '@types/koa*'
- dependency-name: 'koa*'
- dependency-name: '@koa*'
groups:
all:
patterns: ['*']
Expand Down
20 changes: 13 additions & 7 deletions cache/edge_lambdas/src/redirector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ export const getRedirect = (
const requestHost =
hostHeader && hostHeader.length > 0 ? hostHeader[0].value : undefined;

const allowedHosts = [
'www-stage.wellcomecollection.org',
'www-e2e.wellcomecollection.org',
'wellcomecollection.org',
];

const parsedHost = requestHost
? new URL(`http://${requestHost}`).hostname
: undefined;

const host =
requestHost &&
requestHost.indexOf('www-stage.wellcomecollection.org') !== -1
? 'www-stage.wellcomecollection.org'
: requestHost &&
requestHost.indexOf('www-e2e.wellcomecollection.org') !== -1
? 'www-e2e.wellcomecollection.org'
: 'wellcomecollection.org';
parsedHost && allowedHosts.includes(parsedHost)
? parsedHost
: 'wellcomecollection.org';

// We MUST check literalRedirects first
if (literalRedirects[uriSansSlash]) {
Expand Down
10 changes: 10 additions & 0 deletions cache/edge_lambdas/src/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const literalRedirects: Record<string, string> = {

// Old Exhibition guide content type to new Highlights Tour/Text format.
// See https://github.com/wellcomecollection/wellcomecollection.org/issues/11140
// Jason
'/guides/exhibitions/Zdcs4BEAACMA6abC':
'/guides/exhibitions/jason-and-the-adventure-of-254',
'/guides/exhibitions/Zdcs4BEAACMA6abC/audio-without-descriptions':
Expand All @@ -157,6 +158,15 @@ export const literalRedirects: Record<string, string> = {
'/guides/exhibitions/jason-and-the-adventure-of-254/bsl',
'/guides/exhibitions/Zdcs4BEAACMA6abC/captions-and-transcripts':
'/guides/exhibitions/jason-and-the-adventure-of-254/captions-and-transcripts',
// Healing pavilion
'/guides/exhibitions/Y2JgxREAACcJWckj':
'/guides/exhibitions/the-healing-pavilion',
'/guides/exhibitions/Y2JgxREAACcJWckj/audio-without-descriptions':
'/guides/exhibitions/the-healing-pavilion/audio-without-descriptions',
'/guides/exhibitions/Y2JgxREAACcJWckj/bsl':
'/guides/exhibitions/the-healing-pavilion/bsl',
'/guides/exhibitions/Y2JgxREAACcJWckj/captions-and-transcripts':
'/guides/exhibitions/the-healing-pavilion/captions-and-transcripts',
};

// Query redirects have the form:
Expand Down

0 comments on commit 8a1c9bd

Please sign in to comment.