## Description Project Settings starts with an empty response-header rule list. Users can add valid HTTP response headers for all paths (`/*`) or an Authentication-style route such as `/private/*`, and remove any configured rule. The Headers and Authentication views share the accessible rule-list form. The header form suggests standard response-header names and common values for the selected header, while accepting custom names and values. `Set-Cookie` is not suggested because a rule can store only one value per header and would replace existing cookies. `X-Powered-By`, `X-Content-Type-Options`, and `Strict-Transport-Security` are dispatcher-owned and cannot be configured. Users may configure `Content-Security-Policy`, `X-Frame-Options`, and `Referrer-Policy`; when absent, the dispatcher supplies their defaults. The SDK validates header names, values, routes, duplicates, and size limits. The CLI emits only configured rules. Customization requires Pro for custom-domain publishing, while unchanged defaults and staging remain available on Free plans. The server checks the saved production snapshot against the project owner's plan. Companion Cloud worker PR: https://github.com/webstudio-is/webstudio-saas/pull/664. Deploy its dispatcher support before exposing these settings in the Builder. Other hosts need an adapter that applies the generated rules; Webstudio Cloud dispatcher defaults do not apply automatically elsewhere. Static exports do not apply headers automatically. ## Validation - SDK, CLI, Builder browser, publish-warning, and production-build tests pass. - Builder, SDK, and CLI typechecks and lint pass. - The companion Cloud worker tests, typecheck, and lint pass. Replaces https://github.com/webstudio-is/webstudio/pull/6428 to use `headers.staging`. Closes https://github.com/webstudio-is/webstudio/issues/4748
8.9 KiB
description
| description |
|---|
| Set project-wide configuration, including redirects, authentication, and publishing options. |
⚙️ Project settings
Project settings are located in the top left by clicking the Webstudio logo > Project settings.
General
- Site Name – Used to output WebSite structured data to clearly define your website's identity.
- Favicon – Output your logo in search engines, browser tabs, and more.
- Custom Code – Global field to output scripts in the head. Custom Code is often used to add analytics scripts such as Google Analytics, PostHog, Plausible, and any other scripts/code you want to output on every page. Please note that this code does not output in the Builder, so your scripts aren't tracking Builder page views. For outputting a script in the body on every page, use a Slot. For example, add HTML Embed(s) to your Footer Slot so that it outputs on every page.
- Compiler – Atomic CSS reduces the CSS file size by ~70% in many cases. See more below.
Publishing
Atomic CSS
When enabled, the class and CSS structure under the hood contains one style per class. This algorithm allows classes to be reused, significantly reducing the amount of CSS, ultimately leading to a faster-loading website.
For example, in the UI, you may create a Token called “Card” and give it a background color, padding, and a border-radius.
With atomic CSS enabled, it will output like this:
.ceszdr {
background-color: #fff;
}
.c1jykks9 {
border-top-left-radius: 1rem;
}
.c31r7mo {
border-top-right-radius: 1rem;
}
.cywm6f1 {
border-bottom-left-radius: 1rem;
}
.c1q77ydo {
border-bottom-right-radius: 1rem;
}
.cu6yur2 {
padding: 20px;
}
Even though this seems to take up more space, its benefits become apparent as you style more parts of the website. Now, anytime you add 20px of padding, it’ll automatically reuse the cu6yur2 class. Generally speaking, there are somewhat of a finite amount of styles you’ll use on your website, so as the website gets bigger, the CSS file does not grow proportionally – in fact, its growth slows down as the site gets bigger as it doesn’t need to continue creating classes for styles you’ve already used. Pretty neat.
The data
Let’s quantify the CSS file size savings when using atomic CSS on Webstudio.
- 4-page brochure website
- With atomic: 21 KB
- Without atomic: 75 KB
- 23-page SaaS website
- With atomic: 23 KB
- Without atomic: 83 KB
In both cases, enabling atomic CSS reduces the file size by around 72%!
Disabling atomic CSS
Even though atomic CSS improves website performance by reducing the CSS file size, there are use cases to disable it.
When exporting your Project to self-host it, you may want to modify CSS and classes outside of Webstudio. By disabling atomic CSS, your classes are human-readable, instead of using an optimized algorithm.
{% hint style="info" %} If you need classes to target but want to enable atomic CSS, you can add classes in the settings panel. These will always output exactly as they are entered. Watch this short video to learn more. {% endhint %}
When atomic CSS is disabled, your components will have two classes:
- A default class, such as
w-box - Your Tokens and Local Styles merged into another class
The same example from above looks like this when atomic is disabled:
.w-box-1 {
background-color: rgb(255, 255, 255);
border-radius: 1rem;
padding: 20px;
}
Redirects
Redirects old URLs to new ones so that you don’t lose any traffic or search engine rankings. 301 and 302 status codes are available.
Authentication
Use Authentication to require HTTP Basic Auth credentials for one or more routes on custom domains.
This is useful when you want to protect:
- A group of pages, such as
/private/* - Dynamic routes, such as
/blog/:slug - The home page, using
/ - A route that does not map cleanly to one page setting
To add a protected route:
- Open Project settings
- Go to Authentication
- Enter a route, such as
/privateor/docs/*, plus a login and password - Click Add
- Publish the site
Routes use the same syntax as page paths. See Path syntax for supported static routes, dynamic segments, optional segments, and wildcards.
Login and password rules:
- Login is required
- Password is required
- Login cannot contain
: - Login and password cannot contain whitespace
- Password can contain
:
If a page has authentication in Page Settings and the same route is also protected in Project Settings, the page setting takes priority for that route.
{% hint style="info" %} Authentication applies to protected routes on custom domains. Staging domains have their own built-in password protection, described in Publishing & custom domains. {% endhint %}
{% hint style="warning" %} Authentication is a Pro feature for custom domains. You can publish to staging for free, but publishing authentication to custom domains requires a plan that includes it. {% endhint %}
For a single page, you can also configure authentication directly in Page settings.
Headers
Use Project settings > Headers to configure your site's HTTP security response headers. Each header starts with a default value:
| Header | Default | Required |
|---|---|---|
| Content-Security-Policy | frame-ancestors 'self' |
Yes |
| X-Frame-Options | SAMEORIGIN |
No |
| X-Content-Type-Options | nosniff |
Yes |
| Referrer-Policy | strict-origin-when-cross-origin |
Yes |
| Strict-Transport-Security | max-age=63072000; includeSubDomains; preload |
Yes |
Edit values directly in their fields. Changes are saved when you leave a field or press Enter; Escape cancels an unsaved edit. Required headers cannot be removed or left empty. Use the trash icon to remove X-Frame-Options and the reset icon to restore a header’s default value. Publish to apply changes.
On Webstudio Cloud, changing the defaults or removing an optional header requires Pro when publishing to a custom domain. Default values and staging are free. Platform headers such as X-Powered-By are not configurable.
To allow embedding by https://example.com, change Content-Security-Policy to frame-ancestors 'self' https://example.com and remove X-Frame-Options.
These are standard HTTP headers. Webstudio Cloud applies the settings automatically to site responses, including redirects and site errors. Static assets served by the CDN keep their existing headers. On other hosts, your server or hosting adapter must apply the configuration generated by the CLI in app/__generated__/$resources.headers.server.ts, and any proxy or CDN must preserve the resulting headers. Other hosting templates and static exports do not apply these settings automatically.
Header names are case-insensitive. Each header can be configured once, with values up to 8 KB and a combined limit of 16 KB. Values cannot contain line breaks. Arbitrary headers, including cache directives and cookies, cannot be configured in these settings.
Marketplace
You can contribute free or paid templates by creating a Project and submitting it for review. Approved templates will appear in the Marketplace.
For more information, see Contributing to the Marketplace.
Related
- SEO settings – Configure meta tags and social sharing
- Publishing & custom domains – Deploy your site and manage domains
- Page settings – Configure authentication for a single page
- Design tokens – Understand atomic CSS output options
- Head Slot – Add custom code per page
- HTML Embed – Embed analytics and custom scripts