zuplo 7.7.11 → 7.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,93 @@
1
+ ---
2
+ title: "Managed Dedicated: Host Header Override"
3
+ sidebar_label: Host Header Override
4
+ ---
5
+
6
+ By default, the `Host` header your gateway sends to a backend is derived from
7
+ the URL it connects to. Host header override lets your code send a `Host` header
8
+ that differs from the hostname in the request URL, so the gateway can connect to
9
+ one address while the backend sees the hostname it expects.
10
+
11
+ This setting is only available on [Managed Dedicated](../overview.mdx) instances
12
+ and is off by default.
13
+
14
+ ## When to use it
15
+
16
+ Reach for this when the address you connect to and the hostname your backend
17
+ expects aren't the same:
18
+
19
+ - **Virtual-hosted backends.** A single load balancer, ingress controller, or
20
+ web server hosts several sites and picks one based on the `Host` header. Your
21
+ gateway connects to the shared address and names the site it wants.
22
+ - **Private networking.** With
23
+ [private networking](../aws-private-networking.mdx), you reach a backend
24
+ through an internal endpoint or IP whose DNS name doesn't match the public
25
+ hostname the backend is configured for, such as `https://10.0.4.12` with a
26
+ `Host` of `api.acme.com`.
27
+ - **Testing a new backend before DNS moves.** Point the gateway at the new
28
+ origin's address while sending the production `Host` header, so you can
29
+ validate the migration without changing public DNS.
30
+ - **Legacy backends keyed on the hostname.** Applications that route, build
31
+ links, or select a tenant from the `Host` header keep working when the gateway
32
+ sits in front of them.
33
+
34
+ :::caution
35
+
36
+ An incorrect `Host` header can send traffic to the wrong site on a shared
37
+ backend, and some applications trust the header when building redirects and
38
+ links. Enable this setting only if you need it, and set the header to a value
39
+ your code controls rather than one copied from client input.
40
+
41
+ :::
42
+
43
+ ## Enable the setting
44
+
45
+ Add `allowHostHeaderOverride` to the `zuplo.jsonc` file at the root of your
46
+ project and deploy:
47
+
48
+ ```jsonc
49
+ {
50
+ "version": 1,
51
+ "projectType": "managed-dedicated",
52
+ "allowHostHeaderOverride": true,
53
+ }
54
+ ```
55
+
56
+ The setting applies to the whole project. Without it, a `Host` header you set on
57
+ an outbound request is ignored.
58
+
59
+ :::note
60
+
61
+ The `zuplo.jsonc` file isn't editable in the Zuplo Portal. Connect your project
62
+ to [source control](../source-control.mdx) and edit the file there or push a
63
+ local change with git. See
64
+ [Project Configuration](../../programmable-api/zuplo-json.mdx) for the other
65
+ settings this file supports.
66
+
67
+ :::
68
+
69
+ ## Example
70
+
71
+ Once the setting is enabled, set the `Host` header on any outbound request. This
72
+ [custom handler](../../handlers/custom-handler.mdx) connects to an internal load
73
+ balancer and tells it which site to serve:
74
+
75
+ ```ts
76
+ import { ZuploContext, ZuploRequest, environment } from "@zuplo/runtime";
77
+
78
+ export default async function (request: ZuploRequest, context: ZuploContext) {
79
+ const url = new URL(request.url);
80
+
81
+ return fetch(`${environment.INTERNAL_ORIGIN}${url.pathname}${url.search}`, {
82
+ method: request.method,
83
+ body: request.body,
84
+ headers: {
85
+ ...Object.fromEntries(request.headers),
86
+ Host: "api.acme.com",
87
+ },
88
+ });
89
+ }
90
+ ```
91
+
92
+ With `INTERNAL_ORIGIN` set to `https://10.0.4.12`, the gateway connects to
93
+ `10.0.4.12` and the backend receives a request for `api.acme.com`.
@@ -89,11 +89,14 @@ to `false`.
89
89
 
90
90
  Allow the Host header to be overridden by the client. This configuration
91
91
  defaults to `false`. This is only supported in managed dedicated environments.
92
- Only enable this setting if you understand the implications.
92
+ Only enable this setting if you understand the implications. See
93
+ [Host Header Override](../dedicated/advanced/host-header-override.mdx) for when
94
+ to use it and an example.
93
95
 
94
96
  ```jsonc
95
97
  {
96
98
  "version": 1,
99
+ "projectType": "managed-dedicated",
97
100
  "allowHostHeaderOverride": true,
98
101
  }
99
102
  ```
@@ -12,24 +12,22 @@ certificates from cert-manager. Before you begin, complete the
12
12
  Set these variables in the shell that you use for the installation:
13
13
 
14
14
  ```bash
15
- # From the Zuplo portal. See Requirements for instructions.
16
- export ZUPLO_ACCOUNT_NAME='acme-corp'
17
15
 
18
16
  # Provided by Zuplo during onboarding.
19
17
  export ZUPLO_CHART_VERSION='<chart version from onboarding>'
20
18
  export ZUPLO_REGISTRY_KEY='<base64 credential from onboarding>'
21
19
 
22
- # Yours.
23
- export ZUPLO_SUBDOMAIN='api.example.com'
24
- export ZUPLO_MANAGEMENT_HOSTNAME='zuplo-admin.example.com'
25
- export ZUPLO_BUILD_REGISTRY='us-docker.pkg.dev/acme-corp/zuplo-gateways'
26
- export ACME_EMAIL='platform@example.com'
20
+ # Provided by you
21
+
22
+ # These are the credentials to your gateway image registry.
23
+ export BUILDER_REGISTRY_USER='your-example-registry-user'
24
+ export BUILDER_REGISTRY_PASSWORD='your-example-registry-user-pw'
27
25
  ```
28
26
 
29
27
  ## Authenticate to the Zuplo registry
30
28
 
31
- The chart is an OCI artifact in Zuplo's registry. The same credential pulls the
32
- chart and the component images.
29
+ The Zuplo Helm chart is an OCI artifact in Zuplo's registry. The same credential
30
+ pulls the chart and the component images.
33
31
 
34
32
  ```bash
35
33
  printf '%s' "$ZUPLO_REGISTRY_KEY" |
@@ -52,7 +50,8 @@ account:
52
50
 
53
51
  deployments:
54
52
  # Parent domain for your APIs. Needs wildcard DNS:
55
- # *.api.example.com -> your ingress address
53
+ # *.api.example.com -> your ingress address. For example, a preview
54
+ # domain deployment might look like your-preview-branch-abs0ef.api.example.com.
56
55
  subdomain: api.example.com
57
56
 
58
57
  managementApi:
@@ -68,12 +67,11 @@ builder:
68
67
  secretName: builder-secret
69
68
 
70
69
  cert-manager:
71
- # Issues and renews one certificate per deployment hostname. Leaving this on
72
- # is what keeps a wildcard certificate out of the picture.
70
+ # cert-manager is used for managing the lifecyle of each deployment certificate.
73
71
  enabled: true
74
72
  acme:
75
- # Required when cert-manager.enabled is true. The certificate authority
76
- # sends expiration warnings to this address.
73
+ # Required when cert-manager.enabled is true. Used to register the ACME
74
+ # account with the certificate authority.
77
75
  email: platform@example.com
78
76
  ```
79
77
 
@@ -91,17 +89,25 @@ zuploImageRegistry:
91
89
  password: ${ZUPLO_REGISTRY_KEY}
92
90
 
93
91
  builder:
94
- username: _json_key_base64
95
- password: ${ZUPLO_REGISTRY_KEY}
92
+ username: ${BUILDER_REGISTRY_USER}
93
+ password: ${BUILDER_REGISTRY_PASSWORD}
96
94
  EOF
97
95
  ```
98
96
 
99
- :::danger{title="Treat this file as a secret"}
97
+ :::danger{title="Protect registry credentials"}
98
+
99
+ This file contains registry credentials. Add `zuplo-secrets.yaml` to
100
+ `.gitignore` before creating it, restrict access to the file, and delete the
101
+ local copy after installation. Keep the credentials in your organization's
102
+ secret manager for future upgrades.
103
+
104
+ For automated installations, generate the file from CI secrets or a secret
105
+ manager. If you store the file in Git, encrypt it with a tool such as SOPS and
106
+ decrypt it when running Helm.
100
107
 
101
- The chart doesn't support `existingSecret`. It stores these values in Kubernetes
102
- Secrets and in the Helm release history. Don't commit this file as plaintext.
103
- Encrypt it with SOPS or Sealed Secrets, or generate it in CI from a secret
104
- store. Add it to `.gitignore` with your kubeconfig.
108
+ Helm stores these credentials in its release history, and the chart creates
109
+ Kubernetes Secrets from them. Restrict access to these Secrets, including Helm's
110
+ release Secrets.
105
111
 
106
112
  :::
107
113
 
@@ -139,7 +145,8 @@ namespaces:
139
145
 
140
146
  Without `--version`, Helm selects the most recent chart available at
141
147
  installation time. Record the pinned version with `zuplo-values.yaml` so that
142
- you can review and reproduce upgrades.
148
+ you can review and reproduce upgrades. Your Zuplo solutions architect will tell
149
+ you which version to install.
143
150
 
144
151
  :::
145
152
 
@@ -156,17 +163,19 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
156
163
  zuplo-haproxy-ingress LoadBalancer 10.128.82.11 203.0.113.24 80:31670/TCP,443:31011/TCP 50s
157
164
  ```
158
165
 
159
- Create two DNS A records pointing at `EXTERNAL-IP`, both resolving publicly and
160
- neither behind a TLS-terminating proxy:
166
+ Create two DNS A records pointing at EXTERNAL-IP, both resolving publicly:
161
167
 
162
168
  | Type | Name | Value |
163
169
  | ---- | ------------------------- | -------------- |
164
170
  | `A` | `*.api.example.com` | `203.0.113.24` |
165
171
  | `A` | `zuplo-admin.example.com` | `203.0.113.24` |
166
172
 
167
- Certificates can't be issued until these records resolve. cert-manager checks
168
- the challenge URL from inside the cluster before it contacts the certificate
169
- authority.
173
+ Certificate issuance requires the HTTP-01 challenge URL at
174
+ http://<hostname>/.well-known/acme-challenge/<token> to be reachable from inside
175
+ the cluster and the public internet. If you use a proxy such as Cloudflare,
176
+ configure it to forward these requests to the cluster without authentication or
177
+ changes to the challenge response. cert-manager checks the URL before asking the
178
+ certificate authority to validate the challenge.
170
179
 
171
180
  ## Verify your installation
172
181
 
@@ -105,11 +105,18 @@ For HTTP-01 validation, the certificate authority must also reach the ingress on
105
105
  port 80. If your cluster can't expose port 80 to the public internet, discuss an
106
106
  alternative certificate configuration with your Zuplo solutions architect.
107
107
 
108
- ## Access to Zuplo services
109
-
110
- The cluster needs outbound HTTPS to Zuplo services, both container registries,
111
- and your certificate authority. The management API hostname is the only inbound
112
- path.
108
+ The cluster also needs outbound access to:
109
+
110
+ - Zuplo services for deployment configuration and management API authentication.
111
+ - Zuplo's private container registry and the public registries used by the
112
+ chart's bundled components.
113
+ - Your container registry to push and pull gateway images.
114
+ - Docker Hub and Debian package repositories to build gateway images.
115
+ - Your ACME certificate authority to issue and renew certificates.
116
+
117
+ The Helm chart installs the required components, but the cluster downloads their
118
+ container images and gateway build dependencies. If you restrict outbound
119
+ traffic, allow access to these dependencies.
113
120
 
114
121
  :::note
115
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuplo",
3
- "version": "7.7.11",
3
+ "version": "7.7.12",
4
4
  "type": "module",
5
5
  "description": "The official Zuplo CLI for local development and platform management",
6
6
  "homepage": "https://zuplo.com/docs/cli/overview",
@@ -32,9 +32,9 @@
32
32
  "zuplo": "zuplo.js"
33
33
  },
34
34
  "dependencies": {
35
- "@zuplo/cli": "7.7.11",
36
- "@zuplo/core": "7.7.11",
37
- "@zuplo/runtime": "7.7.11",
38
- "@zuplo/test": "7.7.11"
35
+ "@zuplo/cli": "7.7.12",
36
+ "@zuplo/core": "7.7.12",
37
+ "@zuplo/runtime": "7.7.12",
38
+ "@zuplo/test": "7.7.12"
39
39
  }
40
40
  }