commit
f99f634816
7 changed files with 41 additions and 21 deletions
|
@ -6,6 +6,7 @@
|
|||
[![Build Status](https://travis-ci.org/containous/traefik.svg?branch=master)](https://travis-ci.org/containous/traefik)
|
||||
[![Docs](https://img.shields.io/badge/docs-current-brightgreen.svg)](https://docs.traefik.io)
|
||||
[![Go Report Card](https://goreportcard.com/badge/kubernetes/helm)](http://goreportcard.com/report/containous/traefik)
|
||||
[![Image Layer](https://badge.imagelayers.io/traefik:latest.svg)](https://imagelayers.io/?images=traefik)
|
||||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/containous/traefik/blob/master/LICENSE.md)
|
||||
[![Join the chat at https://traefik.herokuapp.com](https://img.shields.io/badge/style-register-green.svg?style=social&label=Slack)](https://traefik.herokuapp.com)
|
||||
[![Twitter](https://img.shields.io/twitter/follow/traefikproxy.svg?style=social)](https://twitter.com/intent/follow?screen_name=traefikproxy)
|
||||
|
@ -51,7 +52,7 @@ Run it and forget it!
|
|||
- Circuit breakers on backends
|
||||
- Round Robin, rebalancer load-balancers
|
||||
- Rest Metrics
|
||||
- Tiny docker image included [![Image Layers](https://badge.imagelayers.io/containous/traefik:latest.svg)](https://imagelayers.io/?images=containous/traefik:latest)
|
||||
- [Tiny](https://imagelayers.io/?images=traefik) [official](https://hub.docker.com/r/_/traefik/) docker image included
|
||||
- SSL backends support
|
||||
- SSL frontend support (with SNI)
|
||||
- Clean AngularJS Web UI
|
||||
|
@ -92,7 +93,7 @@ You can access to a simple HTML frontend of Træfik.
|
|||
- Use the tiny Docker image:
|
||||
|
||||
```shell
|
||||
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml containous/traefik
|
||||
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik
|
||||
```
|
||||
|
||||
- From sources:
|
||||
|
|
|
@ -52,7 +52,7 @@ Transfer/sec: 0.99MB
|
|||
```sh
|
||||
$ docker run -d -l traefik.backend=test1 -l traefik.frontend.rule=Host -l traefik.frontend.value=test.traefik.localhost emilevauge/whoami
|
||||
$ docker run -d -l traefik.backend=test1 -l traefik.frontend.rule=Host -l traefik.frontend.value=test.traefik.localhost emilevauge/whoami
|
||||
$ docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/traefik.toml -v /var/run/docker.sock:/var/run/docker.sock containous/traefik
|
||||
$ docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/traefik.toml -v /var/run/docker.sock:/var/run/docker.sock traefik
|
||||
$ wrk -t12 -c400 -d60s -H "Host: test.traefik.localhost" --latency http://127.0.0.1:80
|
||||
Running 1m test @ http://127.0.0.1:80
|
||||
12 threads and 400 connections
|
||||
|
|
|
@ -57,7 +57,7 @@ You can grab the latest binary from the [releases](https://github.com/containous
|
|||
Using the tiny Docker image:
|
||||
|
||||
```shell
|
||||
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml containous/traefik
|
||||
docker run -d -p 8080:8080 -p 80:80 -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik
|
||||
```
|
||||
|
||||
## Test it
|
||||
|
@ -66,7 +66,7 @@ You can test Træfɪk easily using [Docker compose](https://docs.docker.com/comp
|
|||
|
||||
```yaml
|
||||
traefik:
|
||||
image: containous/traefik
|
||||
image: traefik
|
||||
command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
|
||||
ports:
|
||||
- "80:80"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
traefik:
|
||||
image: containous/traefik
|
||||
image: traefik
|
||||
command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
|
||||
ports:
|
||||
- "80:80"
|
||||
|
|
11
rules.go
11
rules.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"errors"
|
||||
"github.com/gorilla/mux"
|
||||
"net"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"sort"
|
||||
|
@ -12,12 +13,17 @@ import (
|
|||
// Rules holds rule parsing and configuration
|
||||
type Rules struct {
|
||||
route *serverRoute
|
||||
err error
|
||||
}
|
||||
|
||||
func (r *Rules) host(hosts ...string) *mux.Route {
|
||||
return r.route.route.MatcherFunc(func(req *http.Request, route *mux.RouteMatch) bool {
|
||||
reqHost, _, err := net.SplitHostPort(req.Host)
|
||||
if err != nil {
|
||||
reqHost = req.Host
|
||||
}
|
||||
for _, host := range hosts {
|
||||
if strings.EqualFold(req.Host, strings.TrimSpace(host)) {
|
||||
if reqHost == strings.TrimSpace(host) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +135,9 @@ func (r *Rules) Parse(expression string) (*mux.Route, error) {
|
|||
method := reflect.ValueOf(parsedFunction)
|
||||
if method.IsValid() {
|
||||
resultRoute := method.Call(inputs)[0].Interface().(*mux.Route)
|
||||
if r.err != nil {
|
||||
return nil, r.err
|
||||
}
|
||||
if resultRoute.GetError() != nil {
|
||||
return nil, resultRoute.GetError()
|
||||
}
|
||||
|
|
|
@ -31,20 +31,22 @@ ghr -t $GITHUB_TOKEN -u containous -r traefik --prerelease ${VERSION} dist/
|
|||
|
||||
# update docs.traefik.io
|
||||
echo "Generating and updating documentation..."
|
||||
# mkdir site
|
||||
# cd site
|
||||
# git init
|
||||
# git remote add origin git@github.com:containous/traefik.git
|
||||
# git fetch origin
|
||||
# git checkout gh-pages
|
||||
# cd ..
|
||||
# mkdocs build --clean
|
||||
# cd site
|
||||
# git add .
|
||||
# echo $VERSION | git commit --file -
|
||||
# git push -q -f origin gh-pages > /dev/null 2>&1
|
||||
git remote add ssh git@github.com:containous/traefik.git
|
||||
mkdocs gh-deploy -c -r ssh
|
||||
# DOESN'T WORK :'(
|
||||
# git remote add ssh git@github.com:containous/traefik.git
|
||||
# mkdocs gh-deploy -m $VERSION -c -r ssh
|
||||
|
||||
mkdir site
|
||||
cd site
|
||||
git init
|
||||
git remote add origin git@github.com:containous/traefik.git
|
||||
git fetch origin
|
||||
git checkout gh-pages
|
||||
cd ..
|
||||
mkdocs build --clean
|
||||
cd site
|
||||
git add .
|
||||
echo $VERSION | git commit --file -
|
||||
git push -q -f origin gh-pages > /dev/null 2>&1
|
||||
|
||||
# update traefik-library-image repo (official Docker image)
|
||||
echo "Updating traefik-library-imag repo..."
|
||||
|
|
|
@ -24,3 +24,11 @@
|
|||
.tabset-row__providers {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
td, th {
|
||||
word-wrap: break-word;
|
||||
}
|
Loading…
Reference in a new issue