Caddy not showing custom 403 page with Authelia

Hi, I’m new to Caddy, and I was wondering how I can get Caddy to show a custom 403 page when a user fails with Authelia. I have tried the following:

handle_errors {
        @notfound expression `{http.error.status_code} == 404`
        handle @notfound {
            rewrite * /404.html
        }

        @badgateway expression `{http.error.status_code} == 502`
        handle @badgateway {
            rewrite * /502.html
        }

	@forbidden expression `{http.error.status_code} == 403`
	handle @forbidden {
		rewrite * /403.html
	}

        root * /var/www/teamteague
        file_server
    }

I have also tried:

@kuma host uptime.yewtreeweb.uk
	handle @kuma {
		import cloudflare-or-local-only
		forward_auth http://{auth ip}:9091 {
			uri /api/authz/forward-auth?authelia_url=https://auth.yewtreeweb.uk
			copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
		}
    	reverse_proxy {uptime kuma ip} {
			handle_response {
				@403 expression `{http.response.status_code} == 403`
				rewrite * /403.html
			}
		}
    	redir / https://uptime.yewtreeweb.uk/status/services permanent
	}

But I keep getting the default 403 Forbidden message. Any help would be really appreciated. Thanks

You will have to use the expanded form to customize the response

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.