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 HandlerUse CasesMethods
onClientRequest

onClientResponse

Conditionally Route Traffic

Personalization

route()
Cache Key ManipulationexcludeQueryString()

includeQueryString()
includeQueryArgument()
includeCookie()
includeHeader()
includeVariable()

onClientResponse

onClientRequest
onOriginRequest
onOriginResponse

Header ManagementgetHeader()

setHeader()
addHeader()
removeHeader()

Cookie Managementcookies

toHeader()
get()
getAll()
names()
add()
delete()

See the note below.

Delivery Property Flow ControlgetVariable()

setVariable()

Redirect Management

Traffic Filtering
Allow / Deny
Static Response Offload

Refer to the Product limits for information about the supported response size.

respondWith()
responseProviderResponse Orchestration

getHeader()
getHeaders()
getVariable()
text()
json()
arrayBuffer()
createResponse()
httpRequest()

To use the responseProvider functions, you need to
import the create-response, streams,
text-encode-transform, and http-request modules.

Manipulate the response (body, headers)createResponse()

📘

Cookie Management methods

To use theCookie Management methods, you need to import the cookies module.