Skip to content

Commit

Permalink
Fix CDN redirection script
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiemh committed Jul 25, 2024
1 parent a381549 commit d94a75a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/viewer-request/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ function handler(event) {
return request;
}

// Don't process any files which have extensions
if (request.uri.lastIndexOf('.') > request.uri.lastIndexOf('/')) {
// Display any documentation assets and image files
if (path.startsWith('/docs/assets/') || path.startsWith('/docs/img/')) {
return request;
}

// Redirect any paths which have trailing slashes
if (request.uri.endsWith('/') === true) {
return redirect(`https://surrealdb.com/${path.slice(0, -1)}`);
return redirect(`https://surrealdb.com${path.slice(0, -1)}`);
}

// Redirect any capitalised paths to lowercase
Expand Down

0 comments on commit d94a75a

Please sign in to comment.