-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
export const handler = async (event, context, callback) => { | ||
console.log(JSON.stringify(event)); | ||
|
||
// Extract the request from the CloudFront event that is sent to Lambda@Edge | ||
var request = event.Records[0].cf.request; | ||
|
||
// Redirect from DS to WS if match | ||
const workspaceRegex = /(\/products\/|\/addons\/|.aspx)/i; | ||
|
||
if (workspaceRegex.test(request.uri)) | ||
{ | ||
const newurl = `https://${tenantDomain.replace('onlyoffice.io', 'teamlab.info')}${request.uri}?${request.querystring}`; | ||
console.log("redirect to: %s", newurl); | ||
const response = { | ||
status: '302', | ||
statusDescription: 'Found', | ||
headers: { | ||
location: [{ | ||
key: 'Location', | ||
value: newurl, | ||
}], | ||
}, | ||
}; | ||
|
||
return callback(null, response); | ||
|
||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters