Skip to content

Commit

Permalink
Merge pull request #9 from ONLYOFFICE/feature/fix_lowercase
Browse files Browse the repository at this point in the history
Feature/fix lowercase
  • Loading branch information
YaroslavPshenichnikov authored Jan 30, 2024
2 parents ed6d235 + 3e3d296 commit 97a591a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions docspace-reverse-proxy/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ async function getTenantRegion(ddbRegion, tenantDomain) {
TableName: dynamodbTableName
};

console.log("[DynamoDb] before send command get item %s with tenant domain %s", getItemParams, tenantDomain);
console.log("[DynamoDb] before send command get item %s with tenant domain %s", JSON.stringify(getItemParams), tenantDomain);

const response = await ddbClient.send(new GetItemCommand(getItemParams));

console.log("[DynamoDb] responce send command get item %s with tenant domain %s", response, tenantDomain);
console.log("[DynamoDb] responce send command get item %s with tenant domain %s", JSON.stringify(response), tenantDomain);

if (response && response.Item) {

Expand Down Expand Up @@ -72,13 +72,19 @@ export const handler = async (event, context, callback) => {

let originDomain;

if (request.uri == "/apisystem/portal/register" && request.method == "POST") {
console.log("this is body %s", request.body);
if (request.uri.toLowerCase() == "/apisystem/portal/register" && request.method == "POST") {
console.log("START: Register portal request");

console.log("Register portal request body %s", request.body);

let body = JSON.parse(Buffer.from(request.body.data, 'base64').toString('utf8'));
let regionFromRequest = body["awsRegion"];
let portalName = body["portalName"];

if(regionFromRequest !== null && regionFromRequest !== '' && regionFromRequest!==undefined) {
regionFromRequest = regionFromRequest.toLowerCase();
}

originDomain = regionsMap[regionFromRequest];

console.log("Register portal request: Origin Domain is %s, awsRegion is %s", originDomain, regionFromRequest);
Expand Down Expand Up @@ -108,6 +114,8 @@ export const handler = async (event, context, callback) => {

console.log("request after changed %s", JSON.stringify(request));

console.log("END: Register portal request");

// Return to CloudFront
return callback(null, request);
}
Expand Down

0 comments on commit 97a591a

Please sign in to comment.