-
Notifications
You must be signed in to change notification settings - Fork 0
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
Alvin Januar
committed
Jun 2, 2024
1 parent
6e93e41
commit 9979acb
Showing
3 changed files
with
35 additions
and
9 deletions.
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 |
---|---|---|
@@ -1,15 +1,21 @@ | ||
function handler(event) { | ||
var request = event.request; | ||
var uri = request.uri; | ||
var headers = request.headers; | ||
|
||
// Check whether the URI is missing a file name. | ||
if (uri.endsWith("/")) { | ||
request.uri += "index.html"; | ||
if (headers.host.value.includes("phc_9Utfol296QwPeqrpQzwtagBPYXVDjGfDl7kBGt50k5c")) { | ||
if(uri.includes("/static")){ | ||
request.headers.host.value = headers.host.value.replace("phc_9Utfol296QwPeqrpQzwtagBPYXVDjGfDl7kBGt50k5c", "phc_9Utfol296QwPeqrpQzwtagBPYXVDjGfDl7kBGt50k5c-assets") | ||
} | ||
} else { | ||
// Check whether the URI is missing a file name. | ||
if (uri.endsWith("/")) { | ||
request.uri += "index.html"; | ||
} | ||
// Check whether the URI is missing a file extension. | ||
else if (!uri.includes(".")) { | ||
request.uri += "/index.html"; | ||
} | ||
} | ||
// Check whether the URI is missing a file extension. | ||
else if (!uri.includes(".")) { | ||
request.uri += "/index.html"; | ||
} | ||
|
||
return request; | ||
} |
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
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