Hugo: Request Support for Custom 403.html Error Page

Created on 23 Nov 2015  Â·  12Comments  Â·  Source: gohugoio/hugo

Can we please get support for 403.html "Access Denied" page ? Thank you!

Enhancement Stale Wish

Most helpful comment

Create a page with the following frontmatter:

url: /403
layout: 403
---

Then create a layout for it. In the end, you will have to add server rules that point to this error page.

In my own opinion: It's not worth a feature if only 4 people in 4 years require it.

All 12 comments

When is this happening in a static file server?

Yeah but I don't think you can use it the same way like you can /layouts/404.html to include header/footer ;-) This custom error 403 page would go into /layouts/403.html.

I don't fully understand the usefulness of the request. Can you provide more information?

@spf13 Well you have 404.html that we can put inside /layouts/ and then include header/footer partials. But we can't do the same with 403.html "403 Forbidden".

https://gohugo.io/templates/404/

Perhaps even better way is to use special directory for all the custom errors like /layouts/errors/ where we can put 403.html, 404.html and others.

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

Just ran into this myself. Was really confused why my layouts/404.html was being built/rendered fine by layouts/403.html was MIA. The use case seems pretty straightforward...

@bep @spf13 Some parts of the website may be behind some auth_basic password protection...

Also would use this. Developing an intranet site that has authentication with auth_basic. Would be great if the 403 Unauthorized page could be handled the same way as 404..

Create a page with the following frontmatter:

url: /403
layout: 403
---

Then create a layout for it. In the end, you will have to add server rules that point to this error page.

In my own opinion: It's not worth a feature if only 4 people in 4 years require it.

In my own opinion: It's not worth a feature if only 4 people in 4 years require it.

I'm sure there are more than 4 people.

This would be a useful feature to me, where a portal I'm building is only accessible from within a VPN.

I'll use the suggested workaround for now, thanks.

@davidsneighbour As previous commenters have said, also pretty sure it's more than just four people – and I think many new users have been confused + surprised to find this inconsistency here…

It also seems like this was discussed here, showing that a proposed solution was viewed favorably and that fixing this would indeed be "worth" it: https://discourse.gohugo.io/t/how-to-create-custom-error-pages/755/5

Was this page helpful?
0 / 5 - 0 ratings