iali
August 8, 2024, 7:40am
1
Hi, I have my router configured like this:
http:
routers:
taiga-prod-01:
rule: "Host(plan.company.it)"
entryPoints:
- web
- websecure
tls: true
service: taiga-prod-01
middlewares:
- frame-sameorigin
services:
taiga-prod-01:
loadBalancer:
servers:
- url: "http://icslvpl.company.it:11003"
passHostHeader: true
middlewares:
frame-sameorigin:
headers:
customResponseHeaders:
X-Frame-Options: "SAMEORIGIN"
I wanted to make it so that when users try to move to the paths /forgot-password and /user-settings/user-change-password they get 403 or 404, since the credentials are managed by ldap and consequently I want to make these 2 pages unreachable.
I tried to look at the documentation, but I couldn't find anything.
how can i do it?
Thank you
Add a second router
(with different name):
rule: Host(`plan.company.it`) && ( PathPrefix(`/forgot-password `) || PathPrefix(`/user-settings/user-change-password `) )
Not sure if you get the desired effect by leaving service
out completely or if you need to set a non-existing target (maybe 127.0.0.2).
iali
August 8, 2024, 8:29am
3
thanks @bluepuma77 , does not allow management without service, I had it point to 172.0.0.2 as follows, but nothing changes I can still reach those pages.
http:
router:
taiga-prod-01:
rule: "Host(`plan.company.it`)"
entryPoints:
- web
- websecure
tls: true
service: taiga-prod-01
middlewares:
- frame-sameorigin
taiga-prod-01-block:
rule: Host(`plan.company.it.it`) && ( PathPrefix(`/forgot-password`) || PathPrefix(`/user-settings/user-change-password`) )
entryPoints:
- web
- websecure
tls: true
service: taiga-prod-01-block
middlewares:
- frame-sameorigin
service:
taiga-prod-01:
loadBalancer:
servers:
- url: "http://icslvpl.company.it:11003"
passHostHeader: true
taiga-prod-01-block:
loadBalancer:
servers:
- url: "http://172.0.0.2:9999"
passHostHeader: true
At least the 2nd domain in your example is wrong.
The longer rule has higher priority, so should be matched first.
Enable and check Traefik debug log and Traefik access log in JSON format.