[http://127.0.0.1:3000/block](http://127.0.0.1:3000/block) - gives an empty page with 403 status code\n
[http://127.0.0.1:3000/](http://127.0.0.1:3000/) - gives the main page rendered.\n
What should I do to use a custom template for 403 page?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"app->routes->add_condition(auth => sub {\n my ($route, $c, $captures, $num) = @_;\n\n $c->res->code(403);\n $c->rendered(403);\n $c->render(template => \"403\"); # <-- adding this helped\n # Here, you could define your condition. For example, check if a parameter is set.\n return 0; # true/false depending on parameter\n});\n
Yes, it worked.
","upvoteCount":0,"url":"https://github.com/mojolicious/mojo/discussions/2210#discussioncomment-11307605"}}}-
Here is a minimal working example:
What should I do to use a custom template for 403 page? |
Beta Was this translation helpful? Give feedback.
-
Just render it? |
Beta Was this translation helpful? Give feedback.
Yes, it worked.