About the JavaScript API
Review these details when designing EdgeWorkers functions. To learn more about the specific HTTP events that can execute an EdgeWorkers script, see EdgeWorkers event model.
For information about the supported HTTP methods see, Event handler methods.
Use case support matrix
View the event handler and JavaScript method you can use to achieve an EdgeWorkers use case.
| Event Handler | Use Cases | Methods |
|---|---|---|
| onClientRequest | Header Management | getHeader() |
| Cookie Management | cookies toHeader()\ get()\ getAll()\ names()\ add()\ delete() See the note below. | |
| Delivery Property Flow Control | getVariable() | |
| Conditionally Route Traffic
Personalization | route() | |
| Cache Key Manipulation | excludeQueryString() includeQueryString()\ includeQueryArgument()\ includeCookie()\ includeHeader()\ includeVariable() | |
| onOriginRequest
onOriginResponse | Header Management | getHeader() |
| Cookie Management | cookies toHeader()\ get()\ getAll()\ names()\ add()\ delete() See the note below. | |
| Delivery Property Flow Control | getVariable() | |
| Redirect Management
Traffic Filtering Refer to the Product limits for information about the supported response size. | respondWith() | |
| responseProvider | Response Orchestration | getHeader()\ getHeaders()\ getVariable()\ text()\ json()\ arrayBuffer()\ createResponse()\ httpRequest() To use the |
| Manipulate the response (body, headers) | createResponse() | |
| onBotSegmentAvailable
To be used with Bot Manager Premier. | Bot behavior detection | isHuman() isCautiousResponse() \ isStrictResponse() \ isSafeguardResponse() \ isAggressiveResponse() \ isUnexpectedResponse() |
| Redirect Management
Traffic Filtering | respondWith() | |
| Header Management | getHeader() | |
| Delivery Property Flow Control | getVariable() |
Cookie Management methods
To use theCookie Management methods, you need to import the cookies module.
Updated about 24 hours ago
