The response time for requests for simple redirection on HTTP/HTTPS using redirectregex and redirectscheme middlewares is damn slow. Multiple time outs are reported at the browser while browsing those Host sites, as well as while curling the links.
P.S. Have hosted around 480 routers with Hosts/Path values as testing for bulk redirection scenario.
Sample dynamic 'file' provider configuration -
http:
routers:
pratheesh-router0:
rule: "Host(`pratheesh-chacko.ga`)"
middlewares:
- pratheesh-middleware1
service: "pratheesh-service1"
middlewares:
pratheesh-middleware1:
redirectRegex:
regex: "^http://pratheesh-chacko.ga/(.*)"
replacement: "https://google.com/"
permanent: true
services:
pratheesh-service1:
loadBalancer:
servers:
- url: https://google.com/
You can try browsing this host and find the TAT for the request.
Env: Azure Kubernetes Service through Docker Container with 2 Pod serviced under a single deployment
Traefik Dynamic and Static configurations hosted using YAMLs ('file' provider)
These YAMLs containing around 480 routers scenarios are hosted over container using Azure File Share mounted over container as a volume.
Kubernetes service is exposed through a service pointing to an Azure Load Balancer with a public IP.
@vibhujain This is really weird and suspecting it could be a bug possible I gave it a go in a more controlled local environment, here are my results:
Timings in seconds:
With no middleware:
Connect: 0.004274 TTFB: 0.005965 Total time: 0.006092
With redirect-scheme, redirected from http:
Connect: 0.004199 TTFB: 0.014645 Total time: 0.020215
With redirect-regex, redirected from http:
Connect: 0.004205 TTFB: 0.012758 Total time: 0.018608
Measurements were made with this command:
curl -v -L -k -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://whoami.docker.localhost
And this is my configuration file:
http:
routers:
my-router-http:
rule: Host(`whoami.docker.localhost`)
service: whoami-svc
entryPoints:
- web
#middlewares:
#- regex-redirect
#- http-to-https
my-router-https:
rule: Host(`whoami.docker.localhost`)
service: whoami-svc
entryPoints:
- websecure
tls: true
services:
whoami-svc:
loadBalancer:
servers:
- url: http://whoami
middlewares:
http-to-https:
redirectScheme:
scheme: https
permanent: true
regex-redirect:
redirectRegex:
regex: "^http://whoami.docker.localhost/(.*)"
replacement: "https://whoami.docker.localhost/"
permanent: true
The runs just alternated from the commented out middleware in the router. In this case there is negligible differences between doing a direct redirect scheme or applying the regex redirect. Even from running without any middleware to adding a middleware doesn't adds up that much and in every case it was very far from the 1s mark.
We don't have your timings, other than it feeling as "creepy slow", could you provide some data on how you measured it?