Skip to content

Commit

Permalink
Fix redirect problem on dashboard + docs/tests on [web]
Browse files Browse the repository at this point in the history
  • Loading branch information
juliens authored and traefiker committed Jan 11, 2018
1 parent d0f3ad6 commit e2c5f37
Show file tree
Hide file tree
Showing 47 changed files with 134 additions and 88 deletions.
2 changes: 1 addition & 1 deletion api/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type DashboardHandler struct{}
func (g DashboardHandler) AddRoutes(router *mux.Router) {
// Expose dashboard
router.Methods(http.MethodGet).Path("/").HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
http.Redirect(response, request, "/dashboard/", 302)
http.Redirect(response, request, request.Header.Get("X-Forwarded-Prefix")+"/dashboard/", 302)
})
router.Methods(http.MethodGet).PathPrefix("/dashboard/").
Handler(http.StripPrefix("/dashboard/", http.FileServer(&assetfs.AssetFS{Asset: genstatic.Asset, AssetInfo: genstatic.AssetInfo, AssetDir: genstatic.AssetDir, Prefix: "static"})))
Expand Down
6 changes: 2 additions & 4 deletions docs/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,7 @@ Once a day (the first call begins 10 minutes after the start of Træfik), we col
[entryPoints.http]
address = ":80"

[web]
address = ":8080"
[api]

[Docker]
endpoint = "tcp://10.10.10.10:2375"
Expand Down Expand Up @@ -663,8 +662,7 @@ Once a day (the first call begins 10 minutes after the start of Træfik), we col
[entryPoints.http]
address = ":80"

[web]
address = ":8080"
[api]

[Docker]
Endpoint = "xxxx"
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ curl -s "http://localhost:8080/health" | jq .
// average response time in seconds
"average_response_time_sec": 0.8648016000000001,

// request statistics [requires --web.statistics to be set]
// request statistics [requires --statistics to be set]
// ten most recent requests with 4xx and 5xx status codes
"recent_errors": [
{
Expand Down
41 changes: 41 additions & 0 deletions docs/configuration/backends/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ address = ":8080"
# Default: false
#
readOnly = true


# Set the root path for webui and API
#
# Deprecated
# Optional
#
# path = "/mypath"
#
```

## Web UI
Expand Down Expand Up @@ -375,3 +384,35 @@ curl -s "http://localhost:8080/api" | jq .
}
}
```
## Path
As web is deprecated, you can handle the `Path` option like this
```toml
[entrypoints.http]
address=":80"

[entrypoints.dashboard]
address=":8080"

[entrypoints.api]
address=":8081"

#Activate API and Dashboard
[api]
entrypoint="api"

[file]
[backends]
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:8081"

[frontends]
[frontends.frontend1]
entrypoints=["dashboard"]
backend = "backend1"
[frontends.frontend1.routes.test_1]
rule = "PathPrefixStrip:/yourprefix;PathPrefix:/yourprefix"
```
2 changes: 1 addition & 1 deletion docs/configuration/entrypoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Users can be specified directly in the toml file, or indirectly by referencing a
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.auth.basic]
[entryPoints.http.auth.digest]
users = ["test:traefik:a2688e031edb4be6a3797f3882655c05 ", "test2:traefik:518845800f9e2bfb1f1f740ec24f074e"]
usersFile = "/path/to/.htdigest"
```
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ version: '2'
services:
proxy:
image: traefik
command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
command: --api --docker --docker.domain=docker.localhost --logLevel=DEBUG
networks:
- webgateway
ports:
Expand Down
6 changes: 3 additions & 3 deletions docs/user-guide/cluster-docker-consul.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ services:
traefik:
image: traefik:1.5
command:
- "--web"
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
Expand Down Expand Up @@ -155,7 +155,7 @@ The initializer in a docker-compose file will be:
image: traefik:1.5
command:
- "storeconfig"
- "--web"
- "--api"
[...]
- "--consul"
- "--consul.endpoint=consul:8500"
Expand Down Expand Up @@ -199,7 +199,7 @@ services:
image: traefik:1.5
command:
- "storeconfig"
- "--web"
- "--api"
- "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
- "--entrypoints=Name:https Address::443 TLS"
- "--defaultentrypoints=http,https"
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ idleTimeout = "360s"

## Securing Ping Health Check

The `/ping` health-check URL is enabled together with the web admin panel, enabled with the command-line `--web` or config file option `[web]`.
The `/ping` health-check URL is enabled with the command-line `--ping` or config file option `[ping]`.
Thus, if you have a regular path for `/foo` and an entrypoint on `:80`, you would access them as follows:

* Regular path: `http://hostname:80/foo`
Expand Down
3 changes: 1 addition & 2 deletions docs/user-guide/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ RootCAs = [ "./backend.cert" ]
keyFile = "./frontend.key"


[web]
address = ":8080"
[api]

[file]

Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
- image: traefik
name: traefik-ingress-lb
args:
- --web
- --api
- --kubernetes
---
kind: Service
Expand Down Expand Up @@ -182,7 +182,7 @@ spec:
privileged: true
args:
- -d
- --web
- --api
- --kubernetes
---
kind: Service
Expand Down
10 changes: 7 additions & 3 deletions docs/user-guide/kv-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]

[entryPoints]
[entryPoints.api]
address = ":8081"
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"

[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = "integration/fixtures/https/snitest.com.cert"
Expand All @@ -94,8 +97,8 @@ defaultEntryPoints = ["http", "https"]
watch = true
prefix = "traefik"

[web]
address = ":8081"
[api]
entrypoint = "api"
```

And there, the same global configuration in the Key-value Store (using `prefix = "traefik"`):
Expand All @@ -105,6 +108,7 @@ And there, the same global configuration in the Key-value Store (using `prefix =
| `/traefik/loglevel` | `DEBUG` |
| `/traefik/defaultentrypoints/0` | `http` |
| `/traefik/defaultentrypoints/1` | `https` |
| `/traefik/entrypoints/api/address` | `:8081` |
| `/traefik/entrypoints/http/address` | `:80` |
| `/traefik/entrypoints/https/address` | `:443` |
| `/traefik/entrypoints/https/tls/certificates/0/certfile` | `integration/fixtures/https/snitest.com.cert` |
Expand All @@ -115,7 +119,7 @@ And there, the same global configuration in the Key-value Store (using `prefix =
| `/traefik/consul/endpoint` | `127.0.0.1:8500` |
| `/traefik/consul/watch` | `true` |
| `/traefik/consul/prefix` | `traefik` |
| `/traefik/web/address` | `:8081` |
| `/traefik/api/entrypoint` | `api` |

In case you are setting key values manually:

Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/swarm-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ docker-machine ssh manager "docker service create \
--docker.swarmmode \
--docker.domain=traefik \
--docker.watch \
--web"
--api"
```

Let's explain this command:
Expand All @@ -102,7 +102,7 @@ Let's explain this command:
| `--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock` | we bind mount the docker socket where Træfik is scheduled to be able to speak to the daemon. |
| `--network traefik-net` | we attach the Træfik service (and thus the underlying container) to the `traefik-net` network. |
| `--docker` | enable docker backend, and `--docker.swarmmode` to enable the swarm mode on Træfik. |
| `--web` | activate the webUI on port 8080 |
| `--api | activate the webUI on port 8080 |


## Deploy your apps
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/swarm.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ docker $(docker-machine config mhs-demo0) run \
--docker.tls.key=/ssl/server-key.pem \
--docker.tls.insecureSkipVerify \
--docker.watch \
--web
--api
```

Let's explain this command:
Expand All @@ -107,7 +107,7 @@ Let's explain this command:
| `--docker` | enable docker backend |
| `--docker.endpoint=tcp://172.18.0.1:2376` | connect to the swarm master using the docker_gwbridge network |
| `--docker.tls` | enable TLS using the docker-machine keys |
| `--web` | activate the webUI on port 8080 |
| `--api` | activate the webUI on port 8080 |


## Deploy your apps
Expand Down
7 changes: 5 additions & 2 deletions integration/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ func (s *ConsulSuite) skipTestGlobalConfigurationWithClientTLS(c *check.C) {
s.setupConsulTLS(c)
consulHost := s.composeProject.Container(c, "consul").NetworkSettings.IPAddress

err := s.kv.Put("traefik/web/address", []byte(":8081"), nil)
err := s.kv.Put("traefik/api/entrypoint", []byte("api"), nil)
c.Assert(err, checker.IsNil)

err = s.kv.Put("traefik/entrypoints/api/address", []byte(":8081"), nil)
c.Assert(err, checker.IsNil)

// wait for consul
Expand Down Expand Up @@ -341,7 +344,7 @@ func (s *ConsulSuite) TestCommandStoreConfig(c *check.C) {
"/traefik/loglevel": "DEBUG",
"/traefik/defaultentrypoints/0": "http",
"/traefik/entrypoints/http/address": ":8000",
"/traefik/web/address": ":8080",
"/traefik/api/entrypoint": "traefik",
"/traefik/consul/endpoint": consulHost + ":8500",
}

Expand Down
2 changes: 1 addition & 1 deletion integration/etcd3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (s *Etcd3Suite) TestCommandStoreConfig(c *check.C) {
"/traefik/loglevel": "DEBUG",
"/traefik/defaultentrypoints/0": "http",
"/traefik/entrypoints/http/address": ":8000",
"/traefik/web/address": ":8080",
"/traefik/api/entrypoint": "traefik",
"/traefik/etcd/endpoint": ipEtcd + ":4001",
}

Expand Down
2 changes: 1 addition & 1 deletion integration/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func (s *EtcdSuite) TestCommandStoreConfig(c *check.C) {
"/traefik/loglevel": "DEBUG",
"/traefik/defaultentrypoints/0": "http",
"/traefik/entrypoints/http/address": ":8000",
"/traefik/web/address": ":8080",
"/traefik/api/entrypoint": "traefik",
"/traefik/etcd/endpoint": etcdHost + ":4001",
}

Expand Down
8 changes: 5 additions & 3 deletions integration/fixtures/access_log_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ defaultEntryPoints = ["http"]
[entryPoints]
[entryPoints.http]
address = ":8000"
[entryPoints.api]
address = ":7888"

checkNewVersion = false

################################################################
# Web configuration backend
# Api configuration
################################################################
[web]
address = ":7888"
[api]
entryPoint = "api"

################################################################
# File configuration backend
Expand Down
6 changes: 4 additions & 2 deletions integration/fixtures/consul/simple.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ logLevel = "DEBUG"
[entryPoints]
[entryPoints.http]
address = ":8000"
[entryPoints.api]
address = ":8081"


[consul]
endpoint = "{{.ConsulHost}}:8500"
watch = true
prefix = "traefik"

[web]
address = ":8081"
[api]
entryPoint = "api"
6 changes: 4 additions & 2 deletions integration/fixtures/consul/simple_https.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ defaultEntryPoints = ["http","https"]
logLevel = "DEBUG"

[entryPoints]
[entryPoints.api]
address = ":8081"
[entryPoints.http]
address = ":8000"
[entryPoints.https]
Expand All @@ -16,5 +18,5 @@ logLevel = "DEBUG"
prefix = "traefik"
watch = true

[web]
address = ":8081"
[api]
entryPoint = "api"
3 changes: 1 addition & 2 deletions integration/fixtures/consul_catalog/simple.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
defaultEntryPoints = ["http"]
logLevel = "DEBUG"

[web]
address = ":8080"
[api]

[entryPoints]
[entryPoints.http]
Expand Down
2 changes: 1 addition & 1 deletion integration/fixtures/docker/simple.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ logLevel = "DEBUG"
[entryPoints.http]
address = ":8000"

[web]
[api]

[docker]

Expand Down
6 changes: 4 additions & 2 deletions integration/fixtures/dynamodb/simple.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ logLevel = "DEBUG"
[entryPoints]
[entryPoints.http]
address = ":8080"
[entryPoints.api]
address = ":8081"

[dynamodb]
AccessKeyID = "key"
SecretAccessKey = "secret"
Endpoint = "{{.DynamoURL}}"
Region = "us-east-1"

[web]
address = ":8081"
[api]
entryPoint = "api"
6 changes: 4 additions & 2 deletions integration/fixtures/etcd/simple.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ logLevel = "DEBUG"
[entryPoints]
[entryPoints.http]
address = ":8000"
[entryPoints.api]
address = ":8081"


[etcd]
Expand All @@ -13,5 +15,5 @@ logLevel = "DEBUG"
watch = true
useAPIV3 = {{.UseAPIV3}}

[web]
address = ":8081"
[api]
entryPoint = "api"
Loading

0 comments on commit e2c5f37

Please sign in to comment.