How to allow only specific URL's in maintenance mode?

My maintenance mode config is as follows :

if (-f $errorroot/maintenance.html)
{
return 503;
}

error_page 503 @maintenance;

location @maintenance
{
rewrite ^(.*)$ /maintenance.html break;
proxy_method GET;
proxy_pass http://localhost:100;
}

What it is doing is rewriting all the url to /maintenance.html if that
file is present.
Now I want to allow only a few url’s - they have to be accessible during
maintenance mode too.

Can we achieve that?

Posted at Nginx Forum: