On Wed, Apr 28, 2021 at 7:50 PM <theni...@gmail.com> wrote:
>
> .....
>
> redirect [not] <ip-address> to <uri>
>
> I could then accomplish what I want using two location blocks:
>
> location match "^/maintenance.html$" {
>    root "/htdocs/example.com/maintenance"
> }
> location match ".*" {
>    redirect not my.ho.me.ip to scheme://host/maintenance.html
> }

I can’t speak for the OpenBSD developers, but I personally don’t think
this would be generally useful. However, I can maybe give you some
advice on how to accomplish what you want without any changes to httpd.

Back before httpd included what it does today, I used to use a "shim"
that I created to customize HTTP requests to do whatever I needed, even
if the application I was using didn't work due to a lack of some
features in httpd. In my case, it was a PHP file that would modify the
request and then pass everything on to whatever application. I set up a
match rule in httpd.conf that would match anything and set it to call
that shim, which would then dispatch things as needed.

So, some pseudo code for a shim for your instance:

if (isInMaintenanceMode && ipAddress != myIpAddress) {
    // output the maintenance page
} else {
    // load the normal app
}

Hopefully you can figure out something that will work for your
situation.

Tim

Reply via email to