Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mojotx opened this issue Jan 28, 2016 · 13 comments

Comments

@mojotx
Copy link

mojotx commented Jan 28, 2016

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.

@tvlooy
Copy link

tvlooy commented Nov 21, 2016

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

@vetelko
Copy link

vetelko commented Jan 21, 2018

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.

@afh
Copy link

afh commented Jan 29, 2018

@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.

@jaywilliams
Copy link

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

@tvlooy
Copy link

tvlooy commented Jan 30, 2018

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]

@vetelko
Copy link

vetelko commented Jan 31, 2018

@tvlooy
... or try_files in nginx

@B4rb3rouss
Copy link

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

@ghost
Copy link

ghost commented Apr 22, 2018

I agree, this would be very useful. I have a client's new site running on httpd but there are links out there in the wild to pages from their old site that no longer exist. I'd love to be able to give visitors a custom 404 page with a link to the current homepage if they happen to click on them.

@vetelko
Copy link

vetelko commented Apr 22, 2018

@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

@ghost
Copy link

ghost commented Apr 22, 2018

@vetelko

That's that what I'm doing now, but it's kind of tricky. The old site had tons of pages, with lots of duplicate content, non-obvious subdirectory names, etc. I have many of the important ones redirected, but there's a lot I am missing, so a custom 404 to catch those would be great.

@vetelko
Copy link

vetelko commented Apr 22, 2018

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 :(

@Ranguvar
Copy link

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.

@Ranguvar
Copy link

Ranguvar commented Oct 23, 2018

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants