@@ -17,15 +17,15 @@ a web application, configure load balancing for it via a VirtualServer, and appl
17
17
1. Save the HTTP port of the Ingress Controller into a shell variable:
18
18
19
19
```console
20
- IC_HTTP_PORT =<port number>
20
+ IC_HTTPS_PORT =<port number>
21
21
```
22
22
23
23
## Step 1 - Deploy a Web Application
24
24
25
25
Create the application deployment and service:
26
26
27
27
```console
28
- kubectl apply -f cafe.yaml
28
+ kubectl apply -f cafe.yaml -f cafe-secret.yaml
29
29
```
30
30
31
31
## Step 2 - Deploy the API Key Auth Secret
@@ -62,7 +62,7 @@ Note that the VirtualServer references the policy `api-key-policy` created in St
62
62
If you attempt to access the application without providing a valid API Key in a expected header or query param for that VirtualServer:
63
63
64
64
``` console
65
- curl -- resolve cafe.example.com:$IC_HTTP_PORT :$IC_IP http ://cafe.example.com:$IC_HTTP_PORT /
65
+ curl -k -- resolve cafe.example.com:$IC_HTTPS_PORT :$IC_IP https ://cafe.example.com:$IC_HTTPS_PORT /
66
66
```
67
67
68
68
``` text
@@ -78,7 +78,7 @@ curl --resolve cafe.example.com:$IC_HTTP_PORT:$IC_IP http://cafe.example.com:$IC
78
78
If you attempt to access the application providing an incorrect API Key in an expected header or query param for that VirtualServer:
79
79
80
80
``` console
81
- curl -- resolve cafe.example.com:$IC_HTTP_PORT :$IC_IP -H "X-header-name: wrongpassword" http ://cafe.example.com:$IC_HTTP_PORT /coffee
81
+ curl -k -- resolve cafe.example.com:$IC_HTTPS_PORT :$IC_IP -H "X-header-name: wrongpassword" https ://cafe.example.com:$IC_HTTPS_PORT /coffee
82
82
```
83
83
84
84
``` text
@@ -94,7 +94,7 @@ curl --resolve cafe.example.com:$IC_HTTP_PORT:$IC_IP -H "X-header-name: wrongpas
94
94
If you provide a valid API Key in an a header or query defined in the policy, your request will succeed:
95
95
96
96
``` console
97
- curl --resolve cafe.example.com:$IC_HTTPS_PORT:$IC_IP -H "X-header-name: password" https://cafe.example.com:$IC_HTTPS_PORT/coffee
97
+ curl -k - -resolve cafe.example.com:$IC_HTTPS_PORT:$IC_IP -H "X-header-name: password" https://cafe.example.com:$IC_HTTPS_PORT/coffee
98
98
```
99
99
100
100
``` text
@@ -108,7 +108,7 @@ Request ID: 4feedb3265a0430a1f58831d016e846d
108
108
If you attempt to access the /tea path, the request will be allowed without an API Key, because the auth_request directive is turned off for that path with a location snippet:
109
109
110
110
``` console
111
- curl -- resolve cafe.example.com:$IC_HTTP_PORT :$IC_IP http ://cafe.example.com:$IC_HTTP_PORT /tea
111
+ curl -k -- resolve cafe.example.com:$IC_HTTPS_PORT :$IC_IP https ://cafe.example.com:$IC_HTTPS_PORT /tea
112
112
```
113
113
114
114
``` text
0 commit comments