Skip to content

Commit cb05f43

Browse files
authored
wildcards (#222)
1 parent ebcf85c commit cb05f43

File tree

1 file changed

+138
-54
lines changed

1 file changed

+138
-54
lines changed

apps/docs/content/features/dns.mdx

Lines changed: 138 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: DNS and Proxy Configuration Guide
3-
desc: A comprehensive guide for configuring DNS records and proxy settings with Zerops applications, including shared and dedicated IPv4 setups, security measures, and troubleshooting tips.
3+
desc: A comprehensive guide for configuring DNS records and proxy settings with Zerops applications, including shared and dedicated IPv4 setups, wildcard domains, certificate validation, and troubleshooting tips.
44
---
55

66
This guide will show you how to configure DNS records and proxy settings to work with your Zerops applications, with specific implementation details for Cloudflare.
@@ -19,8 +19,8 @@ DNS allows you to set two records based on IP address type:
1919

2020
#### IPv6 only
2121
```bash
22-
Type Name Content Proxy status TTL
23-
AAAA <name> <your-project-ipv6> Proxied Auto
22+
Type Name Content Proxy status TTL
23+
AAAA <your-domain> <your-project-ipv6> Proxied Auto
2424
```
2525

2626
:::note
@@ -31,10 +31,10 @@ Do not add a proxied A record with shared IPv4 - doing so would prevent the prox
3131

3232
#### Dedicated IPv4
3333
```bash
34-
Type Name Content Proxy status TTL
35-
A <name> <your-dedicated-ipv4> Proxied Auto
34+
Type Name Content Proxy status TTL
35+
A <your-domain> <your-dedicated-ipv4> Proxied Auto
3636
# Optional
37-
AAAA <name> <your-project-ipv6> Proxied Auto
37+
AAAA <your-domain> <your-project-ipv6> Proxied Auto
3838
```
3939

4040
:::tip
@@ -43,9 +43,9 @@ Adding also AAAA record can be beneficial as visitors with IPv6 support will con
4343

4444
#### Shared IPv4 *(valid but NOT recommended)*
4545
```bash
46-
Type Name Content Proxy status TTL
47-
AAAA <name> <your-project-ipv6> DNS only Auto
48-
A <name> <zerops-shared-ipv4> Proxied Auto
46+
Type Name Content Proxy status TTL
47+
AAAA <your-domain> <your-project-ipv6> DNS only Auto
48+
A <your-domain> <zerops-shared-ipv4> Proxied Auto
4949
```
5050

5151
:::tip Why not?
@@ -56,9 +56,9 @@ It does not make sense to expose your IPv6 address while proxying the shared IPv
5656

5757
#### Shared IPv4
5858
```bash
59-
Type Name Content Proxy status TTL
60-
AAAA <name> <your-project-ipv6> DNS only Auto
61-
A <name> <zerops-shared-ipv4> DNS only Auto
59+
Type Name Content Proxy status TTL
60+
AAAA <your-domain> <your-project-ipv6> DNS only Auto
61+
A <your-domain> <zerops-shared-ipv4> DNS only Auto
6262
```
6363

6464
:::note Both A + AAAA Required
@@ -67,10 +67,10 @@ Adding AAAA record is essential for shared IPv4 configuration as it serves as a
6767

6868
#### Dedicated IPv4
6969
```bash
70-
Type Name Content Proxy status TTL
71-
A <name> <your-dedicated-ipv4> DNS only Auto
70+
Type Name Content Proxy status TTL
71+
A <your-domain> <your-dedicated-ipv4> DNS only Auto
7272
# Optional
73-
AAAA <name> <your-project-ipv6> DNS only Auto
73+
AAAA <your-domain> <your-project-ipv6> DNS only Auto
7474
```
7575

7676
:::tip
@@ -79,65 +79,86 @@ Adding also AAAA record can be beneficial as visitors with IPv6 support will con
7979

8080
#### IPv6 only
8181
```bash
82-
Type Name Content Proxy status TTL
83-
AAAA <name> <your-project-ipv6> DNS only Auto
82+
Type Name Content Proxy status TTL
83+
AAAA <your-domain> <your-project-ipv6> DNS only Auto
8484
```
8585

8686
:::note
8787
This configuration will only work for users with IPv6 connectivity, which may limit your service accessibility.
8888
:::
8989

90-
### Understanding Shared IPv4 Addresses {#understand-shared-ipv4}
90+
## Wildcard Domain Configuration
9191

92-
Shared IPv4 allows multiple Zerops projects to use the same IPv4 address while maintaining separate routing for each project. Here's how it works:
92+
Zerops supports wildcard domains (`*.<your-domain>`) that allow routing all subdomains to your project.
9393

94-
1. When a visitor makes a request, it first arrives at the shared IPv4 address
95-
2. The system looks at the domain name in the request (using SNI - Server Name Indication)
96-
3. For security, it checks if this domain properly resolves to your project's IPv6 address
97-
4. Only if IPv6 address matches your project will the traffic be routed correctly
94+
### DNS Configuration
95+
#### Method A: Direct configuration of A and AAAA records
96+
Configure wildcard DNS records following the same patterns described in the [DNS Configuration](#dns-configuration) section, using `*.<your-domain>` in the Name field:
9897

99-
This is why configuring both A (IPv4) and AAAA (IPv6) records is crucial when using shared IPv4 addresses - the IPv6 record acts as a security key that helps prevent unauthorized use of the shared IPv4 address.
98+
```bash
99+
Type Name Content Proxy status TTL
100+
A *.<your-domain> <your-ipv4-address> DNS only/Proxied Auto
101+
AAAA *.<your-domain> <your-ipv6-address> DNS only/Proxied Auto
102+
```
100103

101-
## General Troubleshooting Guide
104+
#### Method B: Using a CNAME record
105+
First configure A and AAAA records for your main domain (`<your-domain>`), then set up a CNAME record:
102106

103-
### Common Issues
107+
```bash
108+
Type Name Content Proxy status TTL
109+
CNAME *.<your-domain> <your-domain> DNS only/Proxied Auto
110+
```
104111

105-
1. **DNS Resolution Issues**
106-
- Confirm correct record configuration
107-
- Verify proxy status settings
108-
- Check IPv6 address accuracy
109-
- Allow time for DNS propagation (typically 5-10 minutes)
112+
### Certificate Validation
110113

111-
2. **Connection Problems**
112-
- Test both IPv4 and IPv6 connectivity
113-
- Check proxy server status if applicable
114-
- Confirm port configurations
114+
For proper HTTPS certificate functionality with wildcard domains, configure:
115+
```bash
116+
Type Name Content Proxy status TTL
117+
CNAME _acme-challenge.<your-domain> <your-domain>.zerops.zone DNS only Auto
118+
```
115119

116-
### Validation Steps
120+
This record enables Zerops to issue and verify a wildcard certificate for your domain.
117121

118-
Test your configuration:
119-
```bash
120-
# Check DNS resolution
121-
dig AAAA yourdomain.com
122+
### Higher-Level Wildcard Subdomains
122123

123-
# Verify connectivity
124-
curl -vI https://yourdomain.com
124+
You can also set up higher-level wildcard subdomains like `*.<subdomain>.<your-domain>`:
125125

126-
# Test IPv4 access
127-
curl -4 -v https://yourdomain.com
126+
#### Method A: Direct configuration
127+
```bash
128+
Type Name Content Proxy status TTL
129+
A *.<subdomain>.<your-domain> <your-ipv4-address> DNS only/Proxied Auto
130+
AAAA *.<subdomain>.<your-domain> <your-ipv6-address> DNS only/Proxied Auto
131+
```
128132

129-
# Test IPv6 access
130-
curl -6 -v https://yourdomain.com
133+
#### Method B: Using a CNAME record
134+
```bash
135+
Type Name Content Proxy status TTL
136+
CNAME *.<subdomain>.<your-domain> <subdomain>.<your-domain> DNS only/Proxied Auto
137+
```
138+
or
139+
```bash
140+
Type Name Content Proxy status TTL
141+
CNAME *.<subdomain>.<your-domain> <your-domain> DNS only/Proxied Auto
142+
```
143+
144+
For certificate validation:
145+
```bash
146+
Type Name Content Proxy status TTL
147+
CNAME _acme-challenge.<subdomain>.<your-domain> <subdomain>.<your-domain>.zerops.zone DNS only Auto
131148
```
132149

133-
## Cloudflare Configuration
150+
### Combining Main Domain and Wildcard Domain
134151

135-
### SSL/TLS Mode
152+
To use both `<your-domain>` and `*.<your-domain>`, specify both variants in your [Zerops configuration](/features/access#configuring-http-routing). Zerops automatically issues a single shared certificate for both the main domain and all its subdomains.
153+
154+
## Cloudflare-Specific Configuration
155+
156+
#### SSL/TLS Mode
136157
Set encryption mode to `Full (strict)` or `Full`
137158
- Ensures end-to-end encryption
138159
- *Full* mode requires any SSL certificate (even if self-signed/expired), while *Full (strict)* requires a valid certificate
139160

140-
### Certificate Management
161+
#### Certificate Management
141162
1. Enable Edge Certificates to allow Cloudflare to manage SSL/TLS certificates
142163
2. During initial setup, handle HTTPS settings in one of two ways:
143164
- **Option A (Simple but Limited)**:
@@ -152,10 +173,73 @@ Set encryption mode to `Full (strict)` or `Full`
152173
```
153174
This rule disables Automatic HTTPS Rewrites for the certificate validation path.
154175

155-
### Cloudflare Troubleshooting
176+
## Validation Steps
156177

157-
#### SSL Certificate Problems
158-
- Verify `Always Use HTTPS` is disabled
159-
- If you encounter **too many redirects** or similar SSL errors:
178+
Test your configuration:
179+
```bash
180+
# Check DNS resolution
181+
dig AAAA <your-domain>
182+
183+
# Verify connectivity
184+
curl -vI https://<your-domain>
185+
186+
# Test IPv4 access
187+
curl -4 -v https://<your-domain>
188+
189+
# Test IPv6 access
190+
curl -6 -v https://<your-domain>
191+
```
192+
193+
## Troubleshooting Guide
194+
195+
1. **DNS Resolution Issues**
196+
- Confirm correct record configuration
197+
- Verify proxy status settings
198+
- Check IPv6 address accuracy
199+
- Allow time for DNS propagation (typically 5-10 minutes)
200+
201+
2. **Connection Problems**
202+
- Test both IPv4 and IPv6 connectivity
203+
- Check proxy server status if applicable
204+
- Confirm port configurations
205+
206+
3. **Certificate Issues**
207+
- Verify proper _acme-challenge CNAME configuration for wildcard domains
208+
- Check that DNS records match the domains configured in Zerops
209+
- **Cloudflare-specific certificate problems**:
210+
- Verify `Always Use HTTPS` is disabled
211+
- If you encounter **too many redirects** or similar SSL errors:
160212
- Double-check that SSL/TLS encryption mode is set to *Full* or *Full (strict)*, not *Flexible*
161-
- SSL mode might show incorrectly for newly added domains, try refreshing the page if settings appear incorrect
213+
- SSL mode might show incorrectly for newly added domains, try refreshing the page if settings appear incorrect
214+
215+
## Technical Background
216+
217+
### Understanding Shared IPv4 Addresses {#understand-shared-ipv4}
218+
219+
Shared IPv4 allows multiple Zerops projects to use the same IPv4 address while maintaining separate routing for each project. Here's how it works:
220+
221+
1. When a visitor makes a request, it first arrives at the shared IPv4 address
222+
2. The system looks at the domain name in the request (using SNI - Server Name Indication)
223+
3. For security, it checks if this domain properly resolves to your project's IPv6 address
224+
4. Only if IPv6 address matches your project will the traffic be routed correctly
225+
226+
This is why configuring both A (IPv4) and AAAA (IPv6) records is crucial when using shared IPv4 addresses - the IPv6 record acts as a security key that helps prevent unauthorized use of the shared IPv4 address.
227+
228+
### Certificate Verification Methods
229+
230+
When issuing SSL/TLS certificates, different verification methods are used depending on the certificate type:
231+
232+
#### HTTP-01 vs DNS-01 Verification
233+
234+
- **Regular certificates** (for a single domain like `<your-domain>`) are typically issued using the **HTTP-01** challenge method. This verification checks that you control the domain by placing a specific file at a specific URL.
235+
236+
- **Wildcard certificates** (for domains like `*.<your-domain>`) must be issued using the **DNS-01** challenge method. This method requires creating specific TXT records in your DNS configuration.
237+
238+
### How Zerops Handles Wildcard Certificate Verification
239+
240+
Zerops simplifies the DNS-01 challenge process:
241+
242+
1. You create a CNAME record (e.g., `_acme-challenge.<your-domain> CNAME <your-domain>.zerops.zone`)
243+
2. When a certificate needs to be issued or renewed, Zerops automatically creates the required TXT records on its `zerops.zone` domain
244+
3. The certificate authority verifies these TXT records through the CNAME redirection
245+
4. Once verified, the wildcard certificate is issued without requiring manual intervention

0 commit comments

Comments
 (0)