Using Nginx auth_basic directive with NodeBalancer

Linode Staff

As soon as I put the servers behind a NodeBalancer, all traffic gets stuck in a loop. The username and password is constantly requested. Is there any easy way to avoid this issue?

1 Reply

I'm sorry to hear that you are having trouble getting the auth_basic directive to work properly behind your NodeBalancer. Configuration setups can be tricky, and I'm happy to help!

I took a look at the documentation that Nginx has regarding basic authentication. In their section combining basic authentication with IP restriction it mentions combining IP restriction with HTTP authentication by setting the directive to all access. In this section, you will want to include the IP address of your NodeBalancer.

I'd also like to point out an important note, from our NodeBalancer Reference Guide, for reference when configuring any restrictions on your back-end Linodes:

It’s important to note that while their public IP address is persistent, the private IP address will change. When configuring a firewall or other network restriction on back-end Linodes, be sure to allow the entire 192.168.255.0/24 range and not a specific IP address.

I hope this has been helpful, and feel free to ask the Community any questions you may have by using the reply button below.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct