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
routing: now supporting multiple divergent route/proxies
Fixes#10
Using a frontender file of the format
```shell
[/<route1>,<route2>,...]
<proxy1>
<proxy2>
...
[/<otherRoute1>,/<otherRoute2>,...]
<proxy3>
<proxy4>
...
```
can now route to divergent proxies e.g
```shell
[/foo/,/bar/]
https://orijtech.com
[/]
http://localhost:8889
http://localhost:8899
```
where routes are matched by longest prefix first
so visiting http://localhost:8877/foo/favicon.ico
will redirect to
https://orijtech.com/favicon.ico
whereas
http://localhost:8877/other/mail
will visit
https://google.com/mail
and /food
will redirect to either of:
http://localhost:8889/food
or
http://localhost:8899/food
Copy file name to clipboardExpand all lines: cmd/frontender/main.go
+25-1
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,12 @@ package main
3
3
import (
4
4
"flag"
5
5
"log"
6
+
"os"
6
7
"strings"
7
8
"time"
8
9
9
10
"github.com/orijtech/frontender"
11
+
"github.com/orijtech/namespace"
10
12
)
11
13
12
14
funcmain() {
@@ -17,6 +19,7 @@ func main() {
17
19
varcsvDomainsstring
18
20
varnoAutoWWWbool
19
21
varnonHTTPSRedirectURLstring
22
+
varrouteFilestring
20
23
21
24
flag.StringVar(&csvBackendAddresses, "csv-backends", "", "the comma separated addresses of the backend servers")
22
25
flag.StringVar(&csvDomains, "domains", "", "the comma separated domains that the frontend will be representing")
@@ -25,13 +28,33 @@ func main() {
25
28
flag.StringVar(&nonHTTPSRedirectURL, "non-https-redirect", "", "the URL to which all non-HTTPS traffic will be redirected")
26
29
flag.BoolVar(&noAutoWWW, "no-auto-www", false, "if set, explicits tells the frontend service NOT to make equivalent www CNAMEs of domains, if the www CNAMEs haven't yet been set")
27
30
flag.StringVar(&backendPingPeriodStr, "backend-ping-period", "3m", `the period for which the frontend should ping the backend servers. Please enter this value with the form <DIGIT><UNIT> where <UNIT> could be "ns", "us" (or "µs"), "ms", "s", "m", "h"`)
31
+
flag.StringVar(&routeFile, "route-file", "", "the file containing the routing")
0 commit comments