-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
60 additions
and
2 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
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
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,15 @@ | ||
function handler(event) { | ||
var response = event.response; | ||
var headers = response.headers; | ||
|
||
// Set HTTP security headers | ||
// Since JavaScript doesn't allow for hyphens in variable names, we use the dict["key"] notation | ||
headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; | ||
// headers['content-security-policy'] = { value: "default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'"}; | ||
// headers['x-content-type-options'] = { value: 'nosniff'}; | ||
// headers['x-frame-options'] = {value: 'DENY'}; | ||
// headers['x-xss-protection'] = {value: '1; mode=block'}; | ||
|
||
// Return the response to viewers | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function handler(event) { | ||
|
||
var request = event.request; | ||
|
||
var uri = request.uri; | ||
|
||
|
||
if(uri.includes(".")){ | ||
// is a request for a file , leaeve alone | ||
return request; | ||
} | ||
|
||
if(uri.endsWith("/")){ | ||
//this was a request for for something like /explore/files/ remove the trailing / | ||
request.uri = request.uri.slice(0, -1); | ||
} | ||
|
||
// final case add .html as this was not a file /explore or /explore/ | ||
request.uri +=".html"; | ||
|
||
return request; | ||
} |