Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/content/docs/en/guides/integrations-guide/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,39 @@ export default defineConfig({
});
```

## Experimental features

The following features are also available for use, but may be subject to breaking changes in future updates. Please follow the [`@astrojs/netlify` CHANGELOG](https://github.com/withastro/astro/tree/main/packages/integrations/netlify/CHANGELOG.md) carefully for updates if you are using these features in your project.

### `experimentalStaticHeaders`

<p>
**Type:** `boolean` <br />
**Default:** `false`<br />
<Since v="6.5.0" pkg="@astrojs/netlify"/>
Comment thread
sarah11918 marked this conversation as resolved.
Outdated
</p>
Comment thread
ematipico marked this conversation as resolved.

Enables specifying custom headers for prerendered pages in Netlify's configuration.

If enabled, the adapter will save [static headers in the Framework API config file](https://docs.netlify.com/frameworks-api/#headers) when provided by Astro features, such as Content Security Policy.

For example, when [experimental Content Security Policy](/en/reference/experimental-flags/csp/) is enabled, `experimentalStaticHeaders` can be used to add the CSP `headers` to your Netlify's configuration, instead of creating a `<meta>` element:
Comment thread
sarah11918 marked this conversation as resolved.
Outdated

```js title="astro.config.mjs" {6}
Comment thread
sarah11918 marked this conversation as resolved.
Outdated
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify';

export default defineConfig({
experimental: {
csp: true
},
adapter: netlify({
experimentalStaticHeaders: true
})
});
```


## Examples

* The [Astro Netlify Edge Starter](https://github.com/sarahetter/astro-netlify-edge-starter) provides an example and a guide in the README.
Expand Down
28 changes: 28 additions & 0 deletions src/content/docs/en/guides/integrations-guide/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ i18nReady: true
---

import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'
import Since from '~/components/Since.astro';

This adapter allows Astro to deploy your [on-demand rendered routes and features](/en/guides/on-demand-rendering/) to Node targets, including [server islands](/en/guides/server-islands/), [actions](/en/guides/actions/), and [sessions](/en/guides/sessions/).

Expand Down Expand Up @@ -106,6 +107,33 @@ export default defineConfig({
});
```


### `experimentalStaticHeaders`

<p>
**Type:** `boolean` <br />
**Default:** `false`<br />
<Since v="9.3.0" pkg="@astrojs/node"/>
</p>
Comment thread
ematipico marked this conversation as resolved.

If enabled, the adapter will serve the headers of prerendered pages using the `Response` object when provided by Astro features, such as Content Security Policy.

For example, when [experimental Content Security Policy](/en/reference/experimental-flags/csp/) is enabled, `experimentalStaticHeaders` can be used to add the CSP headers to the `Response` object instead of creating a `<meta>` element:

```js title="astro.config.mjs" {6}
Comment thread
sarah11918 marked this conversation as resolved.
Outdated
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
experimental: {
csp: true
},
adapter: node({
experimentalStaticHeaders: true
})
});
```

## Usage

First, [performing a build](/en/guides/deploy/#building-your-site-locally). Depending on which `mode` selected (see above) follow the appropriate steps below:
Expand Down