Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entrypoint redirections not working with defaultRuleSyntax=v2 in v3.0.0 #10688

Closed
2 tasks done
HalloTschuess opened this issue May 4, 2024 · 1 comment
Closed
2 tasks done
Labels
area/server kind/bug/confirmed a confirmed bug (reproducible).
Milestone

Comments

@HalloTschuess
Copy link

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

I upgraded to v3 by following the migration guide. For easy migration I changed the default rule syntax to v2.

What did you see instead?

After upgrading I noticed that redirections from HTTP to HTTPS no longer work.

What version of Traefik are you using?

Version: 3.0.0
Codename: beaufort
Go version: go1.22.2
Built: 2024-04-29T14:25:59Z
OS/Arch: linux/amd64

What is your environment & configuration?

This is a simple example config:

core:
  defaultRuleSyntax: v2

entryPoints:
  web:
    address: :8080
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: http

  websecure:
    address: :8443

When opening http://localhost:8080 with this config, there is no redirect to http://localhost:8443:

$ curl http://localhost:8080 -vvvv
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Sat, 04 May 2024 05:24:53 GMT
< Content-Length: 19
< 
404 page not found
* Connection #0 to host localhost left intact

Without core.defaultRuleSyntax it works as expected:

$ curl http://localhost:8080 -vvvv
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Location: http://localhost:8443/
< Date: Sat, 04 May 2024 05:25:40 GMT
< Content-Length: 17
< 
* Connection #0 to host localhost left intact
Moved Permanently

If applicable, please paste the log output in DEBUG level

WRN pkg/config/static/static_config.go:347 > v2 rules syntax is now deprecated, please use v3 instead...
INF cmd/traefik/traefik.go:100 > Traefik version dev built on I don't remember exactly version=dev
DBG cmd/traefik/traefik.go:107 > Static configuration loaded [json] staticConfiguration={"core":{"defaultRuleSyntax":"v2"},"entryPoints":{"web":{"address":":8080","forwardedHeaders":{},"http":{"redirections":{"entryPoint":{"permanent":true,"priority":9223372036854775806,"scheme":"http","to":"websecure"}}},"http2":{"maxConcurrentStreams":250},"transport":{"lifeCycle":{"graceTimeOut":"10s"},"respondingTimeouts":{"idleTimeout":"3m0s","readTimeout":"1m0s"}},"udp":{"timeout":"3s"}},"websecure":{"address":":8443","forwardedHeaders":{},"http":{},"http2":{"maxConcurrentStreams":250},"transport":{"lifeCycle":{"graceTimeOut":"10s"},"respondingTimeouts":{"idleTimeout":"3m0s","readTimeout":"1m0s"}},"udp":{"timeout":"3s"}}},"global":{"checkNewVersion":true},"log":{"format":"common","level":"DEBUG"},"providers":{"providersThrottleDuration":"2s"},"serversTransport":{"maxIdleConnsPerHost":200},"tcpServersTransport":{"dialKeepAlive":"15s","dialTimeout":"30s"}}
INF cmd/traefik/traefik.go:605 > 
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://doc.traefik.io/traefik/contributing/data-collection/

INF pkg/server/configurationwatcher.go:73 > Starting provider aggregator aggregator.ProviderAggregator
DBG pkg/server/server_entrypoint_tcp.go:220 > Starting TCP Server entryPointName=web
DBG pkg/server/server_entrypoint_tcp.go:220 > Starting TCP Server entryPointName=websecure
INF pkg/provider/aggregator/aggregator.go:202 > Starting provider *traefik.Provider
INF pkg/provider/aggregator/aggregator.go:202 > Starting provider *acme.ChallengeTLSALPN
DBG pkg/provider/aggregator/aggregator.go:203 > *traefik.Provider provider configuration config={}
DBG pkg/provider/aggregator/aggregator.go:203 > *acme.ChallengeTLSALPN provider configuration config={}
DBG pkg/server/configurationwatcher.go:227 > Configuration received config={"http":{"middlewares":{"redirect-web-to-websecure":{"redirectScheme":{"permanent":true,"port":"8443","scheme":"http"}}},"models":{"web":{},"websecure":{}},"routers":{"web-to-websecure":{"entryPoints":["web"],"middlewares":["redirect-web-to-websecure"],"priority":9223372036854775806,"rule":"HostRegexp(`^.+$`)","service":"noop@internal"}},"serversTransports":{"default":{"maxIdleConnsPerHost":200}},"services":{"noop":{}}},"tcp":{"serversTransports":{"default":{"dialKeepAlive":"15s","dialTimeout":"30s"}}},"tls":{},"udp":{}} providerName=internal
DBG pkg/tls/tlsmanager.go:321 > No default certificate, fallback to the internal generated certificate tlsStoreName=default
DBG pkg/middlewares/redirect/redirect_scheme.go:29 > Creating middleware entryPointName=web middlewareName=redirect-web-to-websecure@internal middlewareType=RedirectScheme routerName=web-to-websecure@internal
DBG pkg/middlewares/redirect/redirect_scheme.go:30 > Setting up redirection to http 8443 entryPointName=web middlewareName=redirect-web-to-websecure@internal middlewareType=RedirectScheme routerName=web-to-websecure@internal
DBG pkg/middlewares/recovery/recovery.go:22 > Creating middleware entryPointName=web middlewareName=traefik-internal
@traefiker
Copy link
Contributor

Closed by #10689.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/server kind/bug/confirmed a confirmed bug (reproducible).
Projects
None yet
Development

No branches or pull requests

3 participants