Skip to content

Commit

Permalink
fixed const not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfox675 committed Oct 22, 2021
1 parent 59bcc1c commit 4c7f30b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/index.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ function handler(event) {
// Set HTTP security headers
// Since JavaScript doesnt allow for hyphens in variable names, we use the dict["key"] notation
//Set new headers
const addAccessControlAllowOrigin = ${add_access_control_allow_origin}
var addAccessControlAllowOrigin = ${add_access_control_allow_origin}
if ( ${add_access_control_allow_origin} == true ) {
headers['access-control-allow-origin'] = [{key: 'Access-Control-Allow-Origin', value: '${access_control_allow_origin_value}'}];
}
const addAccessControlAllowMethods = ${add_access_control_allow_methods}
var addAccessControlAllowMethods = ${add_access_control_allow_methods}
if (addAccessControlAllowMethods) {
headers['access-control-allow-methods'] = [{key: 'Access-Control-Allow-Methods', value: '${access_control_allow_methods_value}'}];
}
const addStrictTransportSecurity = ${add_strict_transport_security}
var addStrictTransportSecurity = ${add_strict_transport_security}
if (addStrictTransportSecurity) {
headers['strict-transport-security'] = [{key: 'Strict-Transport-Security', value: '${strict_transport_security_value}'}];
}
const addContentSecurityPolicy = ${add_content_security_policy}
var addContentSecurityPolicy = ${add_content_security_policy}
if (addContentSecurityPolicy) {
headers['content-security-policy'] = [{key: 'Content-Security-Policy', value: "${content_security_policy_value}"}];
}
const addXContentTypeOptions = ${add_x_content_type_options}
var addXContentTypeOptions = ${add_x_content_type_options}
if (addXContentTypeOptions) {
headers['x-content-type-options'] = [{key: 'X-Content-Type-Options', value: '${x_content_type_options_value}'}];
}
const addXFrameOptions = ${add_x_frame_options}
var addXFrameOptions = ${add_x_frame_options}
if (addXFrameOptions) {
headers['x-frame-options'] = [{key: 'X-Frame-Options', value: '${x_frame_options_value}'}];
}
const addXXssProtection = ${add_x_xss_protection}
var addXXssProtection = ${add_x_xss_protection}
if (addXXssProtection) {
headers['x-xss-protection'] = [{key: 'X-XSS-Protection', value: '${x_xss_protection_value}'}];
}
const addReferrerPolicy = ${add_referrer_policy}
var addReferrerPolicy = ${add_referrer_policy}
if (addReferrerPolicy) {
headers['referrer-policy'] = [{key: 'Referrer-Policy', value: '${referrer_policy_value}'}];
}
const addFeaturePolicy = ${add_feature_policy}
var addFeaturePolicy = ${add_feature_policy}
if (addFeaturePolicy) {
headers['feature-policy'] = [{key: 'Feature-Policy', value: '${feature_policy_value}'}];
}
Expand Down

0 comments on commit 4c7f30b

Please sign in to comment.