Update enable-https.mdx [ADD Traefik] #7571

GITHUB_PR_NUMBER: 9064
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9064

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6177
Co-authored-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
Co-authored-by: Sean Park-Ross <94021366+seanparkross@users.noreply.github.com>
Co-authored-by: Marion Schleifer <5722022+marionschleifer@users.noreply.github.com>
GitOrigin-RevId: 90dc86dae4b3c5a63996bb32de0d48045ad9dd07
This commit is contained in:
hasura-bot 2022-10-27 21:10:32 +05:30
parent 938a0a66cc
commit a649967d40

View File

@ -72,3 +72,78 @@ In order to serve at a URL prefix, use the following configuration:
}
}
```
### [Traefik](https://doc.traefik.io/traefik/)
Here are sample `traefik.toml` and `traefik-dynamic.toml` files to proxy requests to Hasura:
```toml
#traefik.toml
[providers]
[providers.file]
filename = "traefik-dynamic.toml"
[api]
dashboard = true
debug = true
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "web-secure"
scheme = "https"
[entryPoints.web-secure]
address = ":443"
[certificatesResolvers.sample.acme]
email = "myemail@example.com"
storage = "acme.json"
[certificatesResolvers.sample.acme.httpChallenge]
# used during the challenge
entryPoint = "web"
```
```toml
#traefik-dynamic.toml
[http]
[http.routers]
[http.routers.my-router]
rule = "Host(`hasura.example.com`)"
service = "hasura"
entryPoints = ["web-secure"]
[http.routers.my-router.tls]
certResolver = "sample"
[http.services]
[http.services.hasura.loadbalancer]
[[http.services.hasura.loadbalancer.servers]]
url = "http://127.0.0.1:5000"
```
In order to serve at a URL prefix, use the following configuration:
```toml
#traefik-dynamic.toml
...
[http.routers]
[http.routers.my-router]
rule = "Host(`example.com`) && Path(`/hasura`))"
service = "hasura"
entryPoints = ["web-secure"]
[http.routers.my-router.tls]
certResolver = "sample"
...
```
Please note that setting up SSL is not covered in this guide. You can
find more information at the [Traefik docs](https://doc.traefik.io/traefik/https/overview).