Hi
I am using traefik v2.9.9 on kubernetes v1.27.1.
I am looking to protect access to a page via an auth basic middelware.
Here is the configuration
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: mid-treafik-app-front
namespace: dev-app-lan
spec:
basicAuth:
secret: sec-mid-treafik-app-front
I then apply the middelware on my ingress route
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: traefik-svc-app-front-https
namespace: dev-app-lan
spec:
entryPoints:
- websecure
routes:
- kind: Rule
match: Host(loading.xbox.app.fr
)
services:
- name: svc-app-front
port: 80
middlewares:- name: mid-treafik-app-front
tls:
certResolver: letsencrypt
When I access the site, I get the authentication request.
I can authenticate myself to access the site.
But then, at each action on the site, I have the authentication popup that reappears.
Traefik redirects to a kubernetes service which itself redirects to a pod hosting NGINX.
The NGINX configuration within the container is as follows:
server {
proxy_buffers 16 16k;
proxy_buffer_size 16k;
proxy_max_temp_file_size 50M;
listen 80;
resolver 127.0.0.1 ipv6=off;
root /usr/share/nginx/html;
index index.html index.htm;location / { try_files $uri $uri/ /index.html =404; } location /api { try_files $uri @proxy_api; } location @proxy_api { proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Url-Scheme $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://svc-app-backend:8000$request_uri; }
}
I don't understand why traefik doesn't keep the authentication.
Thanks for your help.