Skip to content

Feature Request: Customized 404 pages (without changing code and recompiling) #62

Open

Description

@mojotx

I would like the ability to have more control over the system-generated error pages, besides modifying C code myself and recompiling.

In other words, I don't want my "404 Not Found" pages saying, "OpenBSD httpd" at the bottom and using the Comic Sans font.

The nginx approach using the "error_page" keyword to specify a URI for a given HTTP code would be relatively straightforward to implement, I think. If there is nothing in the httpd.conf file for that server and a given return code, then the fall-back could still use the hard-coded version.

Activity

  1. tvlooy commented on Nov 21, 2016

    @tvlooy

    I'm not going to send this as a patch myself because I don't need it but as an exercise I added such an option https://gist.github.com/tvlooy/8f5c9253f9e283eaee9a77e9721daa52

  2. vetelko commented on Jan 21, 2018

    @vetelko

    Love spartan features and behavior of the httpd, but thanks for this request. 404 is IMO the only one error page which have to "communicate" with the user, provide him with, at least, a link to the site home page. Otherwise we lost this user in most cases.

  3. afh commented on Jan 29, 2018

    @afh

    @reyk What are your thoughts on the changes that @tvlooy did as an exercise to add support for custom error pages?

    IMO it would make a useful addition to httpd (8) and I'd excited to see it in one the the next OpenBSD releases.

  4. jaywilliams commented on Jan 30, 2018

    @jaywilliams

    I throughly agree. I love the minimalist featureset of httpd, but having a fixed 404 error page is not very visitor friendly.

  5. tvlooy commented on Jan 30, 2018

    @tvlooy

    what I would like is have an option to handle requests with factcgi if the requested location is not a file or directory. Like in Apache:

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
    
  6. vetelko commented on Jan 31, 2018

    @vetelko

    @tvlooy
    ... or try_files in nginx

  7. B4rb3rouss commented on Feb 21, 2018

    @B4rb3rouss

    @vetelko said everything. This is a small improvement very useful for visitor. Hope to see this in httpd too.

  8. vetelko commented on Apr 22, 2018

    @vetelko

    @jsfierro in this case you should try to redirect (if old url structure allows this) user using 301 code from old url to new url or to homepage

  9. vetelko commented on Apr 22, 2018

    @vetelko

    if som logical pattern in old url strcuture is missing than you are right. can't you switch to nginx for now? I doubt custom 404 via directive in httpd.conf will be solved anytime soon :(

  10. Ranguvar commented on Jun 20, 2018

    @Ranguvar

    Just want to note that @tvlooy's patch is working brilliantly for me as of 6.3 httpd.

    Thank you! Hopefully this is looked at for a future release.

  11. Ranguvar commented on Oct 23, 2018

    @Ranguvar

    Updated for 6.4: https://gist.github.com/Ranguvar/7fdec9c8f0a55edad4cdabb4c5c59f79
    Not working for me on 6.4, may be patch issue or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions