Skip to content

Commit 08e7347

Browse files
Merge pull request #25 from workleap/docs/options-docs
docs: available options
2 parents 0f2b09e + 8042175 commit 08e7347

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed

docs/available-options.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,50 @@ icon: gear
66

77
## `secretEnvironmentVariableName`
88

9-
TBD
9+
Specifies the name of the environment variable that holds the secret used for signing the cookie with HMAC encryption to prevent tampering. To override the default value, use the `secretEnvironmentVariableName` option:
10+
11+
```ts !#2 skew-protection.ts
12+
createSkewProtectionFunction("spa", {
13+
secretEnvironmentVariableName: "HMAC_SECRET"
14+
});
15+
```
1016

1117
## `cookieName`
1218

13-
TBD
19+
Defines the name of the cookie that stores the deploy ID associated with the user's session. To change the cookie name, use the `cookieName` option:
20+
21+
```ts !#2 skew-protection.ts
22+
createSkewProtectionFunction("spa", {
23+
cookieName: "my_app_sp"
24+
});
25+
```
1426

1527
## `cookiePath`
1628

17-
TBD
29+
Specifies the cookie path for the deployment ID cookie associated with the user session. To change the cookie path, use the `cookiePath` option:
30+
31+
```ts !#2 skew-protection.ts
32+
createSkewProtectionFunction("spa", {
33+
cookiePath: "/my-app"
34+
});
35+
```
1836

1937
## `cookieMaxAgeInMs`
2038

21-
TBD
39+
Sets the maximum age (in milliseconds) of the cookie holding the deployment ID. To customize the expiration, use the `cookieMaxAgeInMs` option:
40+
41+
```ts !#2 skew-protection.ts
42+
createSkewProtectionFunction("spa", {
43+
cookieMaxAgeInMs: 1000 * 60 * 30 * 24
44+
});
45+
```
46+
47+
## `verbose`
2248

23-
## `debug`
49+
Enables additional logging in the [Edge Functions logs](https://docs.netlify.com/edge-functions/get-started/#monitor) to assist with troubleshooting. To enable verbose logging, set the `verbose` option to `true`:
2450

25-
TBD
51+
```ts !#2 skew-protection.ts
52+
createSkewProtectionFunction("spa", {
53+
verbose: true
54+
});
55+
```

docs/getting-started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The example above assumes that the application's entry point is `index.html`. If
8787

8888
### Register the Edge Function
8989

90-
Now, lets register the Edge Function with Netlify. If the project doesn't already include a `netlify.toml` file, create one at the root of the project:
90+
Now, let's register the Edge Function with Netlify. If the project doesn't already include a `netlify.toml` file, create one at the root of the project:
9191

9292
``` !#4
9393
web-project
@@ -112,7 +112,7 @@ Then, open the `netlify.toml` file and add/replace the following configuration t
112112

113113
If your application is deployed using a combination of an Azure DevOps pipeline or a GitHub Action along with the Netlify CLI, you're all set, no additional steps are required to build the Edge Function.
114114

115-
However, if your application is built and deployed using [Netlify Continuous Deployment](https://www.netlify.com/blog/enhance-your-development-workflow-with-continuous-deployment), an existing [limitation](https://developers.netlify.com/sdk/edge-functions/get-started#limitations) in Netlifys Edge Function support for imported NPM packages requires additional steps. In this case, you'll need to explicitly build the Edge Function using [Rslib](https://lib.rsbuild.dev/).
115+
However, if your application is built and deployed using [Netlify Continuous Deployment](https://www.netlify.com/blog/enhance-your-development-workflow-with-continuous-deployment), an existing [limitation](https://developers.netlify.com/sdk/edge-functions/get-started#limitations) in Netlify's Edge Function support for imported NPM packages requires additional steps. In this case, you'll need to explicitly build the Edge Function using [Rslib](https://lib.rsbuild.dev/).
116116

117117
#### Rslib
118118

@@ -199,7 +199,7 @@ Finally, update the project's `package.json` file to build both, the application
199199
}
200200
```
201201

202-
#### The esm.sh alternative
202+
#### esm.sh alternative
203203

204204
Using [esm.sh](https://esm.sh/) to import the package is a more straightforward approach, but it introduces an additional third-party dependency. To load the [@workleap/netlify-skew-protection](https://www.npmjs.com/package/@workleap/netlify-skew-protection) package via `esm.sh`, you can use the following import directly in your Edge Function:
205205

@@ -255,6 +255,6 @@ To verify that Skew Protection is working as expected, follow these steps:
255255

256256
- If the logs indicate that the Edge Function isn't installed correctly, it's likely because the `SKEW_PROTECTION_SECRET` environment variable is missing from the Netlify site's configuration.
257257

258-
- If requests to previous deploy assets aren't being re-routed as expected, enable the [debug](./available-options.md#debug) option, redeploy the Edge Function, and inspect the [Edge Functions logs](https://docs.netlify.com/edge-functions/get-started/#monitor) for details.
258+
- If requests to previous deploy assets aren't being re-routed as expected, enable the [verbose](./available-options.md#verbose) option, redeploy the Edge Function, and inspect the [Edge Functions logs](https://docs.netlify.com/edge-functions/get-started/#monitor) for details.
259259

260260

0 commit comments

Comments
 (0)