You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/spring-apps/how-to-configure-enterprise-spring-cloud-gateway.md
+119-6Lines changed: 119 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,14 +56,17 @@ To assign an endpoint in the Azure portal, use the following steps:
56
56
57
57
After a few minutes, **URL** shows the configured endpoint URL. Save the URL to use later.
58
58
59
-
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-overview.png" alt-text="Screenshot of Azure portal showing the Spring Cloud Gateway overview page for an Azure Spring Apps instance with the Assign endpoint buttons highlighted and the configured endpoint URL displayed." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-overview.png":::
59
+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-overview.png" alt-text="Screenshot of the Azure portal showing the Spring Cloud Gateway overview page with Assign endpoint highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-overview.png":::
60
60
61
61
#### [Azure CLI](#tab/Azure-CLI)
62
62
63
63
Use the following command to assign the endpoint.
64
64
65
65
```azurecli
66
-
az spring gateway update --assign-endpoint
66
+
az spring gateway update \
67
+
--resource-group <resource-group-name> \
68
+
--service <Azure-Spring-Apps-instance-name> \
69
+
--assign-endpoint true
67
70
```
68
71
69
72
---
@@ -89,21 +92,23 @@ You can use the Azure portal and the Azure CLI to edit metadata properties.
89
92
90
93
#### [Azure portal](#tab/Azure-portal)
91
94
92
-
To edit metadata in the Azure portal, do these steps:
95
+
To edit metadata in the Azure portal, use the following steps:
93
96
94
97
1. Open your Azure Spring Apps instance.
95
98
1. Select **Spring Cloud Gateway** in the navigation pane, and then select **Configuration**.
96
99
1. Specify values for the properties listed for **API**.
97
100
1. Select **Save**.
98
101
99
-
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-configuration.png" alt-text="Screenshot of Azure portal showing the Spring Cloud Gateway configuration page for an Azure Spring Apps instance with the API section highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-configuration.png":::
102
+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-configuration.png" alt-text="Screenshot of Azure portal showing the Spring Cloud Gateway configuration page for an Azure Spring Apps instance, with the API section highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-configuration.png":::
100
103
101
104
#### [Azure CLI](#tab/Azure-CLI)
102
105
103
106
Use the following command to configure VMware Spring Cloud Gateway metadata properties. You need the endpoint URL obtained from the [Configure Spring Cloud Gateway](#configure-spring-cloud-gateway) section.
104
107
105
108
```azurecli
106
109
az spring gateway update \
110
+
--resource-group <resource-group-name> \
111
+
--service <Azure-Spring-Apps-instance-name> \
107
112
--api-description "<api-description>" \
108
113
--api-title "<api-title>" \
109
114
--api-version "v0.1" \
@@ -137,14 +142,16 @@ To edit SSO properties in the Azure portal, use the following steps:
137
142
1. Specify values for the properties listed for **SSO**.
138
143
1. Select **Save**.
139
144
140
-
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sso-configuration.png" alt-text="Screenshot of Azure portal showing the Spring Cloud Gateway configuration page for an Azure Spring Apps instance with the Single Sign On section highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sso-configuration.png":::
145
+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sso-configuration.png" alt-text="Screenshot of Azure portal showing the Spring Cloud Gateway configuration page for an Azure Spring Apps instance, with the Single Sign On section highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sso-configuration.png":::
141
146
142
147
#### [Azure CLI](#tab/Azure-CLI)
143
148
144
149
Use the following command to configure SSO properties for VMware Spring Cloud Gateway.
145
150
146
151
```azurecli
147
152
az spring gateway update \
153
+
--resource-group <resource-group-name> \
154
+
--service <Azure-Spring-Apps-instance-name> \
148
155
--client-id <client-id> \
149
156
--client-secret <client-secret> \
150
157
--issuer-uri <issuer-uri> \
@@ -182,7 +189,7 @@ The following steps describe an example of how to implement the function in your
182
189
183
190
### Log out just the SSO session
184
191
185
-
If you send the `GET` request to the `/scg-logout` endpoint using a `XMLHttpRequest` (XHR), then the `302` redirect could be swallowed and not handled in the response handler. In this case, the user would only be logged out of the SSO session on the gateway service instance and would still have a valid IdP session. The behavior typically seen in this case is that if the user attempts to log in again, they're automatically sent back to the gateway as authenticated from IdP.
192
+
If you send the `GET` request to the `/scg-logout` endpoint using a `XMLHttpRequest` (XHR), then the `302` redirect could be swallowed and not handled in the response handler. In this case, the user would only be logged out of the SSO session on the gateway service instance and would still have a valid IdP session. The behavior typically seen is that if the user attempts to log in again, they're automatically sent back to the gateway as authenticated from IdP.
186
193
187
194
You need to have a route configuration to route the logout request to your application, as shown in the following example. This code makes a gateway-only logout SSO session.
188
195
@@ -266,6 +273,8 @@ Use the following command to set up APM using Azure CLI:
266
273
267
274
```azurecli
268
275
az spring gateway update \
276
+
--resource-group <resource-group-name> \
277
+
--service <Azure-Spring-Apps-instance-name> \
269
278
--apm-types <APM-type> \
270
279
--properties <key=value> \
271
280
--secrets <key=value>
@@ -275,6 +284,8 @@ The allowed values for `--apm-types` are `ApplicationInsights`, `AppDynamics`, `
275
284
276
285
```azurecli
277
286
az spring gateway update \
287
+
--resource-group <resource-group-name> \
288
+
--service <Azure-Spring-Apps-instance-name> \
278
289
--apm-types ApplicationInsights \
279
290
--properties APPLICATIONINSIGHTS_CONNECTION_STRING=<THE CONNECTION STRING OF YOUR APPINSIGHTS> APPLICATIONINSIGHTS_SAMPLE_RATE=10
280
291
```
@@ -289,6 +300,108 @@ You can also put environment variables in the `--secrets` parameter instead of `
289
300
> By default, Azure Spring Apps prints the logs of the APM Java agent to `STDOUT`. These logs are included with the Spring Cloud Gateway logs. You can check the version of the APM agent used in the logs. You can query these logs in Log Analytics to troubleshoot.
290
301
> To make the APM agents work correctly, increase the CPU and memory of Spring Cloud Gateway.
291
302
303
+
## Configure TLS between gateway and applications
304
+
305
+
To enhance security and protect sensitive information from interception by unauthorized parties, you can enable Transport Layer Security (TLS) between Spring Cloud Gateway and your applications. This section explains how to configure TLS between a gateway and applications.
306
+
307
+
Before configuring TLS, you need to have a TLS-enabled application and a TLS certificate. To prepare a TLS certificate, generate a certificate from a trusted certificate authority (CA). The certificate verifies the identity of the server and establishes a secure connection.
308
+
309
+
After you have a TLS-enabled application running in Azure Spring Apps, upload the certificate to Azure Spring Apps. For more information, see the [Import a certificate](how-to-use-tls-certificate.md#import-a-certificate) section of [Use TLS/SSL certificates in your application in Azure Spring Apps](how-to-use-tls-certificate.md).
310
+
311
+
With the certificate updated to Azure Spring Apps, you can now configure the TLS certificate for the gateway and enable certificate verification. You can configure the certification in the Azure portal or by using the Azure CLI.
312
+
313
+
#### [Azure portal](#tab/Azure-portal)
314
+
315
+
Use the following steps to configure the certificate in the Azure portal:
316
+
317
+
1. In your Azure Spring Apps instance, select **Spring Cloud Gateway** in the navigation pane.
318
+
1. On the **Spring Cloud Gateway** page, select **Certificate management**.
319
+
1. Select **Enable cert verification**.
320
+
1. Select the TLS certificate in **Certificates**.
321
+
1. Select **Save**.
322
+
323
+
Updating the configuration can take a few minutes. You should get a notification when the configuration is complete.
324
+
325
+
#### [Azure CLI](#tab/Azure-CLI)
326
+
327
+
Use the following command to enable or disable certificate verification using the Azure CLI. Be sure to replace the *`<value>`* placeholder with *true* to enable or *false* to disable verification.
You must specify the protocol as HTTPS in the route configuration. The following JSON object instructs the gateway to use the HTTPS protocol for all traffic between the gateway and the app.
342
+
343
+
1. Create a file named *test-tls-route.json* with the following content.
344
+
345
+
```json
346
+
{
347
+
"routes": [
348
+
{
349
+
"title": "TestTLS app",
350
+
"predicates": [
351
+
"Path=/path/to/your/app",
352
+
"Method=GET"
353
+
]
354
+
}
355
+
],
356
+
"uri": "https://<app-custom-domain-name>"
357
+
}
358
+
```
359
+
360
+
1.Use the following command to apply the rule to the application:
361
+
362
+
```azurecli
363
+
az spring gateway route-config create \
364
+
--resource-group <resource-group-name> \
365
+
--service <Azure-Spring-Apps-instance-name> \
366
+
--name test-tls-app \
367
+
--routes-file test-tls-route.json
368
+
```
369
+
370
+
You can now test whether the application is TLS enabled with the endpoint of the gateway. For more information, see the [Configure routes](how-to-use-enterprise-spring-cloud-gateway.md#configure-routes) section of [UseSpringCloudGateway](how-to-use-enterprise-spring-cloud-gateway.md).
371
+
372
+
### Rotate certificates
373
+
374
+
As certificates expire, you need to rotate certificates in SpringCloudGateway by using the following steps:
375
+
376
+
1.Generatenew certificates from a trusted CA.
377
+
1. Import the certificates into AzureSpringApps. For more information, see the [Import a certificate](how-to-use-tls-certificate.md#import-a-certificate) section of [UseTLS/SSL certificates in your application in AzureSpringApps](how-to-use-tls-certificate.md).
378
+
1.Synchronize the certificates, using the Azure portal or the AzureCLI.
379
+
380
+
The gateway restarts accordingly to ensure that the gateway uses the new certificate for all connections.
381
+
382
+
#### [Azure portal](#tab/Azure-portal)
383
+
384
+
Use the following steps to synchronize certificates.
385
+
386
+
1.In your AzureSpringApps instance, select **SpringCloudGateway** in the navigation pane.
387
+
1.On the **SpringCloudGateway** page, select **Certificate management**.
388
+
1.Select the certificate you imported in **Certificates**.
389
+
1.Select**sync certificate**, and confirm the operation.
390
+
391
+
:::image type="content" source="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sync-certificate.png" alt-text="Screenshot of the Azure portal showing the Spring Cloud Gateway page for Certificate Management with the sync certificate prompt highlighted." lightbox="media/how-to-configure-enterprise-spring-cloud-gateway/gateway-sync-certificate.png":::
392
+
393
+
#### [AzureCLI](#tab/Azure-CLI)
394
+
395
+
Use the following command to synchronize a certificate forSpringCloudGateway.
396
+
397
+
```azurecli
398
+
az spring gateway sync-cert \
399
+
--resource-group <resource-group-name> \
400
+
--service <Azure-Spring-Apps-instance-name>
401
+
```
402
+
403
+
---
404
+
292
405
## Next steps
293
406
294
407
- [How to UseSpringCloudGateway](how-to-use-enterprise-spring-cloud-gateway.md)
0 commit comments