nginx/docker-nginx-unprivileged

Can we create environment variables and redirect to maintenance page using IF condition

Closed this issue · 1 comments

Hi Team,

So, I already have a custom maintenance page with me. I want to redirect to that based on the IF condition mentioned below.

if ($ENV_MAINTAINANCE_MODE ~ Yes) {
rewrite https://example.com/service-maintenance.html
break;
}

Now, I want to understand how can i create the env variable like this $ENV_MAINTAINANCE_MODE in the nginx conf and how can I flag this variable to Yes and No?
Everytime I dont want to redeploy the application like toggling to yes and toggling to no. Will there be way to do this at global level or at the base image?

Hey @Sheelayathakula! This is an NGINX config question and as such this is not the right venue to ask it. I'd suggest checking the resources listed here https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/SUPPORT.md#nginx-specific-questions-andor-issues instead 😄