Forum: NGINX auth_basic & avoiding duplication in conf file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Adriano N. (Guest)
on 2008-11-13 00:13
(Received via mailing list)
Hi,

Sorry if this is a faq. I started using v0.6.32 and I have to turn on
/ off auth based on the url.

I have something like:

server {
    auth_basic ...

    location ~* jpeg {
    }

    location /home/return {
        auth_basic off
    }

    location / {
        several_config_lines
    }
}

The problem is, I would like "involved_config" to apply to
"/home/return" as well, but I don't want to copy it there.

I can't move it to server, because it shouldn't apply to other
location directives (eg jpeg).

Is there a clean way around it?

Thanks,
mike (Guest)
on 2008-11-13 00:20
(Received via mailing list)
You can put it in an include and then include yourauthconf.conf;

That's the quick and dirty idea..
Adriano N. (Guest)
on 2008-11-13 15:13
(Received via mailing list)
On Wed, Nov 12, 2008 at 8:13 PM, mike <removed_email_address@domain.invalid> 
wrote:
> You can put it in an include and then include yourauthconf.conf;
>
> That's the quick and dirty idea..

Ah, very good. I feel better now :-)

Thanks Mike!
This topic is locked and can not be replied to.