URL: /rules/perf/preconnect

---
title: "Preconnect Hints"
description: "Checks for preconnect hints to critical third-party origins"
---

Checks for preconnect hints to critical third-party origins

| | |
|---|---|
| **Rule ID** | `perf/preconnect` |
| **Category** | [Performance](/rules/perf) |
| **Scope** | Per-page |
| **Severity** | info |
| **Weight** | 4/10 |

## Solution

Preconnect establishes early connections to important third-party origins, saving time on DNS lookup, TCP handshake, and TLS negotiation. Add `<link rel='preconnect' href='https://example.com'>` for CDNs and critical third-party services. Use crossorigin attribute for CORS resources like fonts. Limit preconnects to 2-4 most critical origins to avoid connection congestion.

## Enable / Disable

### Disable this rule

```toml squirrel.toml
[rules]
disable = ["perf/preconnect"]
```

### Disable all Performance rules

```toml squirrel.toml
[rules]
disable = ["perf/*"]
```

### Enable only this rule

```toml squirrel.toml
[rules]
enable = ["perf/preconnect"]
disable = ["*"]
```
