Hi dear Traefik Community,
I want to provide a Traefik endpoint that routes the request to GitHub in order to access the repository content. But I couldn't get it to work.
dynamic.yml
http:
routers:
github-router:
rule: Host(`localhost`)
service: github-service
entryPoints:
- github
middlewares:
- github-authentication
tls: {}
services:
github-service:
loadBalancer:
servers:
- url: "https://api.github.com/"
httpbin-service:
loadBalancer:
servers:
- url: "https://httpbin.org/"
middlewares:
github-authentication:
headers:
customRequestHeaders:
Authorization: "Bearer <my-token-goes-here>"
Accept: "application/vnd.github.v3.raw"
tls:
certificates:
- certFile: /etc/ssl/local/pubkey.pem
keyFile: /etc/ssl/local/private.key
I am always getting a Bad Request response from GitHub when I call the Traefik endpoint with curl https://localhost
. If I call curl -H 'Authorization: Bearer <my-token-goes-here>' -H 'Accept: application/vnd.github.v3.raw' https://api.github.com
it's working fine.
The routing is working without any problem If I replace the github-service
with the httpbin-service
in http.routers.github-router.service
and call curl https://localhost/get
for example.
Could you please show me where I have made a mistake.
Many thanks in advance.