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
Enhance HTTPserver to support nginx-like header vars and build-in backend pool (#1497)
* HTTPServer: Support set headers with nginx-like vars
* HTTPServer: test nginx-like vars
* HTTPServer: Implement backendPool with generating proxy pipeline
* Support labels for metadata of object
* Add httpserver owner label and fix unittest
* Fix Validate of validator spec
* Use cluster to manage generated pipeline instead traffic controller
* Forbid updating generated objects
* Update quick start to adopt backend pool in HTTPServer
* Doc: Add nginx header vars
* Doc: Update header size
* Fix unit tests
* Fix TestPathValidate
Copy file name to clipboardExpand all lines: docs/01.Getting-Started/1.1.Quick-Start.md
+47-15Lines changed: 47 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,10 @@
2
2
3
3
The basic usage of Easegress is to quickly set up a proxy for the backend servers.
4
4
5
-
###Launch Easegress
5
+
## Launch Easegress
6
6
7
7
Easegress can be installed from pre-built binaries or from source. For details, see [Install](1.2.Install.md).
8
8
9
-
10
9
Then we can execute the server:
11
10
12
11
```bash
@@ -17,7 +16,7 @@ $ easegress-server
17
16
18
17
By default, Easegress opens ports 2379, 2380, and 2381; however, you can modify these settings along with other arguments either in the configuration file or via command-line arguments. For a complete list of arguments, please refer to the `easegress-server --help` command.
19
18
20
-
After launching successfully, we could check the status of the one-node cluster.
19
+
After launching successfully, we could check the status of the one-node cluster.
21
20
22
21
```bash
23
22
$ egctl get member
@@ -27,40 +26,72 @@ $ egctl describe member
27
26
...
28
27
```
29
28
30
-
###Reverse Proxy
29
+
## Reverse Proxy
31
30
32
31
Assuming you have two backend HTTP services running at `127.0.0.1:9095` and `127.0.0.1:9096`, you can initiate an HTTP proxy from port 10080 to these backends using the following command:
The request will be forwarded to either `127.0.0.1:9095/pipeline` or `127.0.0.1:9096/pipeline`, utilizing a round-robin load-balancing policy.
46
46
47
47
```bash
48
-
$ curl -v 127.0.0.1:10080/prefix/123
48
+
curl -v 127.0.0.1:10080/prefix/123
49
49
```
50
-
The request will be forwarded to `127.0.0.1:9097/prefix/123`.
51
50
51
+
The request will be forwarded to `127.0.0.1:9097/prefix/123`.
52
+
53
+
## YAML Configuration
52
54
53
-
### YAML Configuration
55
+
The `egctl create httpproxy` command is convenient, but for production use, you'll want more control. Easegress uses two main resources: **HTTPServer** (handles incoming requests) and **Pipeline** (processes and routes requests).
54
56
55
-
The `egctl create httpproxy` command mentioned above is actually syntactic sugar; it creates two Easegress resources under the hood: `HTTPServer` and `Pipeline`.
57
+
### Method 1: HTTPServer with Built-in Backend Pool
56
58
57
-
Now let's create them using yaml files:
59
+
This approach automatically creates pipelines for you:
60
+
61
+
```bash
62
+
$ echo'kind: HTTPServer
63
+
name: demo-backend-pool
64
+
port: 10080
65
+
https: false
66
+
rules:
67
+
- paths:
68
+
- pathPrefix: /demo0
69
+
backendPool:
70
+
loadBalance:
71
+
policy: roundRobin
72
+
servers:
73
+
- url: http://127.0.0.1:9091
74
+
- url: http://127.0.0.1:9092
75
+
- pathPrefix: /demo1
76
+
backendPool:
77
+
loadBalance:
78
+
policy: roundRobin
79
+
servers:
80
+
- url: http://127.0.0.1:9093
81
+
- url: http://127.0.0.1:9094'| egctl create -f -
82
+
```
83
+
84
+
It will generate one pipeline for each backendPool. For example, `demo-backend-pool` generates pipeline`GENERATED-demo-backend-pool-0-0` and `GENERATED-demo-backend-pool-0-1` which couldn't be updated or deleted via `egctl` (User APIs).
85
+
86
+
### Method 2: HTTPServer with Separate Pipelines
87
+
88
+
Create HTTPServer:
58
89
59
90
```bash
60
91
$ echo'
61
92
kind: HTTPServer
62
-
name: demo
63
-
port: 10080
93
+
name: demo-backend
94
+
port: 10081
64
95
https: false
65
96
rules:
66
97
- paths:
@@ -69,7 +100,8 @@ rules:
69
100
- pathPrefix: /prefix
70
101
backend: demo-1 '| egctl create -f -
71
102
```
72
-
More details about [HTTPServer](../02.Tutorials/2.2.HTTP-Proxy-Usage.md).
103
+
104
+
Create the Pipelines:
73
105
74
106
```bash
75
107
$ echo'
@@ -98,7 +130,7 @@ filters:
98
130
- servers:
99
131
- url: http://127.0.0.1:9097'| egctl create -f -
100
132
```
133
+
101
134
More details about [Pipeline](../02.Tutorials/2.3.Pipeline-Explained.md).
102
135
103
136
You can also modify, update, or delete these resources using `egctl`; for more details, refer to the [egctl usage](../02.Tutorials/2.1.egctl-Usage.md) guide.
0 commit comments