nginxinc / docker-nginx-unprivileged

Unprivileged NGINX Dockerfiles
https://hub.docker.com/r/nginxinc/nginx-unprivileged
Apache License 2.0
389 stars 153 forks source link

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

Closed Sheelayathakula closed 1 month ago

Sheelayathakula commented 3 months ago

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?

alessfg commented 1 month ago

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 😄