mirror of
https://github.com/traefik/traefik.git
synced 2025-05-05 23:43:01 +00:00
Merge branch v2.11 into v3.3
This commit is contained in:
commit
4fd6b10b7d
1
.github/workflows/build.yaml
vendored
1
.github/workflows/build.yaml
vendored
@ -61,6 +61,7 @@ jobs:
|
|||||||
ImageOS: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.goarm }}
|
ImageOS: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.goarm }}
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Artifact webui
|
- name: Artifact webui
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
1
.github/workflows/experimental.yaml
vendored
1
.github/workflows/experimental.yaml
vendored
@ -33,6 +33,7 @@ jobs:
|
|||||||
ImageOS: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.goarm }}
|
ImageOS: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.goarm }}
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make generate binary
|
run: make generate binary
|
||||||
|
1
.github/workflows/release.yaml
vendored
1
.github/workflows/release.yaml
vendored
@ -41,6 +41,7 @@ jobs:
|
|||||||
ImageOS: ${{ matrix.os }}
|
ImageOS: ${{ matrix.os }}
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Artifact webui
|
- name: Artifact webui
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
2
.github/workflows/test-integration.yaml
vendored
2
.github/workflows/test-integration.yaml
vendored
@ -28,6 +28,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Avoid generating webui
|
- name: Avoid generating webui
|
||||||
run: touch webui/static/index.html
|
run: touch webui/static/index.html
|
||||||
@ -55,6 +56,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Avoid generating webui
|
- name: Avoid generating webui
|
||||||
run: touch webui/static/index.html
|
run: touch webui/static/index.html
|
||||||
|
1
.github/workflows/test-unit.yaml
vendored
1
.github/workflows/test-unit.yaml
vendored
@ -27,6 +27,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Avoid generating webui
|
- name: Avoid generating webui
|
||||||
run: touch webui/static/index.html
|
run: touch webui/static/index.html
|
||||||
|
3
.github/workflows/validate.yaml
vendored
3
.github/workflows/validate.yaml
vendored
@ -25,6 +25,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v6
|
||||||
@ -44,6 +45,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: Install misspell ${{ env.MISSPELL_VERSION }}
|
- name: Install misspell ${{ env.MISSPELL_VERSION }}
|
||||||
run: curl -sfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSPELL_VERSION}
|
run: curl -sfL https://raw.githubusercontent.com/golangci/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSPELL_VERSION}
|
||||||
@ -67,6 +69,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
- name: go generate
|
- name: go generate
|
||||||
run: |
|
run: |
|
||||||
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -1,3 +1,14 @@
|
|||||||
|
## [v2.11.19](https://github.com/traefik/traefik/tree/v2.11.19) (2025-01-29)
|
||||||
|
[All Commits](https://github.com/traefik/traefik/compare/v2.11.18...v2.11.19)
|
||||||
|
|
||||||
|
**Bug fixes:**
|
||||||
|
- **[middleware]** Changing log message when client cert is not available to debug ([#11453](https://github.com/traefik/traefik/pull/11453) by [Nelwhix](https://github.com/Nelwhix))
|
||||||
|
- **[service]** Do not create a logger instance for each proxy ([#11487](https://github.com/traefik/traefik/pull/11487) by [kevinpollet](https://github.com/kevinpollet))
|
||||||
|
- **[webui]** Fix auto refresh not clearing on component unmount ([#11477](https://github.com/traefik/traefik/pull/11477) by [DoubleREW](https://github.com/DoubleREW))
|
||||||
|
|
||||||
|
**Documentation:**
|
||||||
|
- Remove awesome.traefik.io reference in documentation section ([#11435](https://github.com/traefik/traefik/pull/11435) by [kevinpollet](https://github.com/kevinpollet))
|
||||||
|
|
||||||
## [v3.3.2](https://github.com/traefik/traefik/tree/v3.3.2) (2025-01-14)
|
## [v3.3.2](https://github.com/traefik/traefik/tree/v3.3.2) (2025-01-14)
|
||||||
[All Commits](https://github.com/traefik/traefik/compare/v3.3.1...v3.3.2)
|
[All Commits](https://github.com/traefik/traefik/compare/v3.3.1...v3.3.2)
|
||||||
|
|
||||||
|
@ -90,8 +90,6 @@ You can access the simple HTML frontend of Traefik.
|
|||||||
|
|
||||||
You can find the complete documentation of Traefik v3 at [https://doc.traefik.io/traefik/](https://doc.traefik.io/traefik/).
|
You can find the complete documentation of Traefik v3 at [https://doc.traefik.io/traefik/](https://doc.traefik.io/traefik/).
|
||||||
|
|
||||||
A collection of contributions around Traefik can be found at [https://awesome.traefik.io](https://awesome.traefik.io).
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
To get community support, you can:
|
To get community support, you can:
|
||||||
|
@ -193,7 +193,7 @@ func setupServer(staticConfiguration *static.Configuration) (*server.Server, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
acmeProviders := initACMEProvider(staticConfiguration, providerAggregator, tlsManager, httpChallengeProvider, tlsChallengeProvider)
|
acmeProviders := initACMEProvider(staticConfiguration, providerAggregator, tlsManager, httpChallengeProvider, tlsChallengeProvider, routinesPool)
|
||||||
|
|
||||||
// Tailscale
|
// Tailscale
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ func switchRouter(routerFactory *server.RouterFactory, serverEntryPointsTCP serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initACMEProvider creates and registers acme.Provider instances corresponding to the configured ACME certificate resolvers.
|
// initACMEProvider creates and registers acme.Provider instances corresponding to the configured ACME certificate resolvers.
|
||||||
func initACMEProvider(c *static.Configuration, providerAggregator *aggregator.ProviderAggregator, tlsManager *traefiktls.Manager, httpChallengeProvider, tlsChallengeProvider challenge.Provider) []*acme.Provider {
|
func initACMEProvider(c *static.Configuration, providerAggregator *aggregator.ProviderAggregator, tlsManager *traefiktls.Manager, httpChallengeProvider, tlsChallengeProvider challenge.Provider, routinesPool *safe.Pool) []*acme.Provider {
|
||||||
localStores := map[string]*acme.LocalStore{}
|
localStores := map[string]*acme.LocalStore{}
|
||||||
|
|
||||||
var resolvers []*acme.Provider
|
var resolvers []*acme.Provider
|
||||||
@ -455,7 +455,7 @@ func initACMEProvider(c *static.Configuration, providerAggregator *aggregator.Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if localStores[resolver.ACME.Storage] == nil {
|
if localStores[resolver.ACME.Storage] == nil {
|
||||||
localStores[resolver.ACME.Storage] = acme.NewLocalStore(resolver.ACME.Storage)
|
localStores[resolver.ACME.Storage] = acme.NewLocalStore(resolver.ACME.Storage, routinesPool)
|
||||||
}
|
}
|
||||||
|
|
||||||
p := &acme.Provider{
|
p := &acme.Provider{
|
||||||
|
@ -10,24 +10,24 @@
|
|||||||
# Use certificate in net/internal/testcert.go
|
# Use certificate in net/internal/testcert.go
|
||||||
rootCAs = [ """
|
rootCAs = [ """
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIIDOTCCAiGgAwIBAgIQSRJrEpBGFc7tNb1fb5pKFzANBgkqhkiG9w0BAQsFADAS
|
MIIDSDCCAjCgAwIBAgIQEP/md970HysdBTpuzDOf0DANBgkqhkiG9w0BAQsFADAS
|
||||||
MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw
|
MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw
|
||||||
MDAwWjASMRAwDgYDVQQKEwdBY21lIENvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
|
MDAwWjASMRAwDgYDVQQKEwdBY21lIENvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
|
||||||
MIIBCgKCAQEA6Gba5tHV1dAKouAaXO3/ebDUU4rvwCUg/CNaJ2PT5xLD4N1Vcb8r
|
MIIBCgKCAQEAxcl69ROJdxjN+MJZnbFr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WGI
|
bYINKi5leGFtcGxlLmNvbYcEfwAAAYcQAAAAAAAAAAAAAAAAAAAAATANBgkqhkiG
|
||||||
5NhpF3nwwy/4yB4i/CwwSpLrWUa70NyhvprUBC50PxiXav1TeDzwzLx/o5HyNwsv
|
9w0BAQsFAAOCAQEACrRNgiioUDzxQftd0fwOa6iRRcPampZRDtuaF68yNHoNWbOu
|
||||||
cxv3HdkLW59i/0SlJSrNnWdfZ19oTcS+6PtLoVyISgtyN6DpkKpdG1cOkW3Cy2P2
|
LUwc05eOWxRq3iABGSk2xg+FXM3DDeW4HhAhCFptq7jbVZ+4Jj6HeJG9mYRatAxR
|
||||||
+tK/tKHRP1Y/Ra0RiDpOAmqn0gCOFGz8+lqDIor/T7MTpibL3IxqWfPrvfVRHL3B
|
Y/dEpa0D0EHhDxxVg6UzKOXB355n0IetGE/aWvyTV9SiDs6QsaC57Q9qq1/mitx5
|
||||||
grw/ZQTTIVjjh4JBSW3WyWgNo/ikC1lrVxzl4iPUGptxT36Cr7Zk2Bsg0XqwbOvK
|
2GFBoapol9L5FxCc77bztzK8CpLujkBi25Vk6GAFbl27opLfpyxkM+rX/T6MXCPO
|
||||||
5d+NTDREkSnUbie4GeutujmX3Dsx88UiV6UY/4lHJa6I5leHUNOHahRbpbWeOfs/
|
6/YBacNZ7ff1/57Etg4i5mNA6ubCpuc4Gi9oYqCNNohftr2lkJr7REdDR6OW0lsL
|
||||||
WkBKOclmOV2xlTVuPw==
|
rF7r4gUnKeC7mYIH1zypY7laskopiLFAfe96Kg==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
"""]
|
"""]
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIIDOTCCAiGgAwIBAgIQSRJrEpBGFc7tNb1fb5pKFzANBgkqhkiG9w0BAQsFADAS
|
MIIDSDCCAjCgAwIBAgIQEP/md970HysdBTpuzDOf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6UY/4lHJa6I5leHUNOHahRbpbWeOfs/
|
6/YBacNZ7ff1/57Etg4i5mNA6ubCpuc4Gi9oYqCNNohftr2lkJr7REdDR6OW0lsL
|
||||||
WkBKOclmOV2xlTVuPw==
|
rF7r4gUnKeC7mYIH1zypY7laskopiLFAfe96Kg==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
@ -151,7 +151,7 @@ func (p *passTLSClientCert) ServeHTTP(rw http.ResponseWriter, req *http.Request)
|
|||||||
if req.TLS != nil && len(req.TLS.PeerCertificates) > 0 {
|
if req.TLS != nil && len(req.TLS.PeerCertificates) > 0 {
|
||||||
req.Header.Set(xForwardedTLSClientCert, getCertificates(ctx, req.TLS.PeerCertificates))
|
req.Header.Set(xForwardedTLSClientCert, getCertificates(ctx, req.TLS.PeerCertificates))
|
||||||
} else {
|
} else {
|
||||||
logger.Warn().Msg("Tried to extract a certificate on a request without mutual TLS")
|
logger.Debug().Msg("Tried to extract a certificate on a request without mutual TLS")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ func (p *passTLSClientCert) ServeHTTP(rw http.ResponseWriter, req *http.Request)
|
|||||||
headerContent := p.getCertInfo(ctx, req.TLS.PeerCertificates)
|
headerContent := p.getCertInfo(ctx, req.TLS.PeerCertificates)
|
||||||
req.Header.Set(xForwardedTLSClientCertInfo, url.QueryEscape(headerContent))
|
req.Header.Set(xForwardedTLSClientCertInfo, url.QueryEscape(headerContent))
|
||||||
} else {
|
} else {
|
||||||
logger.Warn().Msg("Tried to extract a certificate on a request without mutual TLS")
|
logger.Debug().Msg("Tried to extract a certificate on a request without mutual TLS")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package acme
|
package acme
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
@ -23,9 +24,9 @@ type LocalStore struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewLocalStore initializes a new LocalStore with a file name.
|
// NewLocalStore initializes a new LocalStore with a file name.
|
||||||
func NewLocalStore(filename string) *LocalStore {
|
func NewLocalStore(filename string, routinesPool *safe.Pool) *LocalStore {
|
||||||
store := &LocalStore{filename: filename, saveDataChan: make(chan map[string]*StoredData)}
|
store := &LocalStore{filename: filename, saveDataChan: make(chan map[string]*StoredData)}
|
||||||
store.listenSaveAction()
|
store.listenSaveAction(routinesPool)
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,18 +101,31 @@ func (s *LocalStore) get(resolverName string) (*StoredData, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// listenSaveAction listens to a chan to store ACME data in json format into `LocalStore.filename`.
|
// listenSaveAction listens to a chan to store ACME data in json format into `LocalStore.filename`.
|
||||||
func (s *LocalStore) listenSaveAction() {
|
func (s *LocalStore) listenSaveAction(routinesPool *safe.Pool) {
|
||||||
safe.Go(func() {
|
routinesPool.GoCtx(func(ctx context.Context) {
|
||||||
logger := log.With().Str(logs.ProviderName, "acme").Logger()
|
logger := log.With().Str(logs.ProviderName, "acme").Logger()
|
||||||
for object := range s.saveDataChan {
|
for {
|
||||||
data, err := json.MarshalIndent(object, "", " ")
|
select {
|
||||||
if err != nil {
|
case <-ctx.Done():
|
||||||
logger.Error().Err(err).Send()
|
return
|
||||||
}
|
|
||||||
|
|
||||||
err = os.WriteFile(s.filename, data, 0o600)
|
case object := <-s.saveDataChan:
|
||||||
if err != nil {
|
select {
|
||||||
logger.Error().Err(err).Send()
|
case <-ctx.Done():
|
||||||
|
// Stop handling events because Traefik is shutting down.
|
||||||
|
return
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := json.MarshalIndent(object, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Err(err).Send()
|
||||||
|
}
|
||||||
|
|
||||||
|
err = os.WriteFile(s.filename, data, 0o600)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Err(err).Send()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package acme
|
package acme
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -9,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/traefik/traefik/v3/pkg/safe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocalStore_GetAccount(t *testing.T) {
|
func TestLocalStore_GetAccount(t *testing.T) {
|
||||||
@ -45,7 +47,7 @@ func TestLocalStore_GetAccount(t *testing.T) {
|
|||||||
|
|
||||||
for _, test := range testCases {
|
for _, test := range testCases {
|
||||||
t.Run(test.desc, func(t *testing.T) {
|
t.Run(test.desc, func(t *testing.T) {
|
||||||
s := NewLocalStore(test.filename)
|
s := NewLocalStore(test.filename, safe.NewPool(context.Background()))
|
||||||
|
|
||||||
account, err := s.GetAccount("test")
|
account, err := s.GetAccount("test")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -58,7 +60,7 @@ func TestLocalStore_GetAccount(t *testing.T) {
|
|||||||
func TestLocalStore_SaveAccount(t *testing.T) {
|
func TestLocalStore_SaveAccount(t *testing.T) {
|
||||||
acmeFile := filepath.Join(t.TempDir(), "acme.json")
|
acmeFile := filepath.Join(t.TempDir(), "acme.json")
|
||||||
|
|
||||||
s := NewLocalStore(acmeFile)
|
s := NewLocalStore(acmeFile, safe.NewPool(context.Background()))
|
||||||
|
|
||||||
email := "some@email.com"
|
email := "some@email.com"
|
||||||
|
|
||||||
|
@ -307,6 +307,8 @@ func TestHeadRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNoContentLengthResponse(t *testing.T) {
|
func TestNoContentLengthResponse(t *testing.T) {
|
||||||
|
t.Skip("Waiting for a fix")
|
||||||
|
|
||||||
backendListener, err := net.Listen("tcp", ":0")
|
backendListener, err := net.Listen("tcp", ":0")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export default function PaginationMixin (opts = {}) {
|
|||||||
this.fetchMore()
|
this.fetchMore()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeUnmount () {
|
||||||
clearInterval(this.pollingInterval)
|
clearInterval(this.pollingInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user