-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Edge Function initiator_type + Expand functional tests (#120)
* chore: expand functional tests * chore: add new data-source edge_firewall * fix: adding a field initiator_type in resource_edgeFunction.go #patch * chore: add new sed to domain cname func-tests * chore: add edge firewall edge functions instance * chore: update sed func-tests --------- Co-authored-by: diegoazion <[email protected]>
- Loading branch information
1 parent
4b1e892
commit 7844631
Showing
8 changed files
with
183 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
async function firewallHandler(event){ | ||
// Access the country code through geoip | ||
let countryCode = event.request.metadata["geoip_country_code"] | ||
|
||
// Do some logic here | ||
// In this example, if the request comes from Brazil, we add a header to the response | ||
if (countryCode === "BR"){ | ||
event.addResponseHeader("test", "true"); | ||
} | ||
|
||
// Then, if it comes from any other country, | ||
// the processing continues | ||
event.continue(); | ||
} | ||
|
||
addEventListener("firewall", (event)=>event.waitUntil(firewallHandler(event))); |
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
Oops, something went wrong.