Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:44:18+00:00 2026-06-09T12:44:18+00:00

I am trying to authenticate several locations together with proxy_pass in Nginx. The Nginx

  • 0

I am trying to authenticate several locations together with proxy_pass in Nginx. The Nginx config is following:

server {
    listen       443;
    server_name  example.com;

    location /hg/ {
        rewrite      ^/hg/(.*)$ /$1 break;
        proxy_pass   http://127.0.0.1:8001;

        auth_basic            "hg";
        auth_basic_user_file  hg.htpasswd;

        location /hg/repo1/ {
            auth_basic            "hg-repo1";
            auth_basic_user_file  repo1.htpasswd;
        }

        location /hg/repo2/ {
            auth_basic            "hg-repo2";
            auth_basic_user_file  repo2.htpasswd;
        }
    }
}

The authentication works ok, but the proxy gets broken in nested locations (repo1, repo2). It seems that proxy_pass config is not inherited. So, Nginx returns 404 (on /hg/repo1 and /hg/repo2).

Any hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:44:19+00:00Added an answer on June 9, 2026 at 12:44 pm

    You need to repeat proxy_pass for each location block.

    Also, there is no function to nesting the location blocks. Usually they are not nested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to authenticate to a web server from an android class with the
I'm trying to authenticate a user on my symfony2 server. The authentication works with
I'm trying to authenticate with a server over HTTPS. I'm having problems with the
I am trying to authenticate to a server's secure URL using java.net.urlconnection - based
I am trying to authenticate against google, and this is their example request: POST
When trying to authenticate via OAuth in Django Piston, the following exception is thrown:
I'm trying to authenticate access to all resources on my server via HTTP Basic
I'm trying to authenticate againest an ldap server I've created. The user password is
I'm trying to authenticate with an XMPP server using SASL. /** * Send Authentication,
I'm trying to authenticate with a tomcat server through LDAP. Then after I'm authenticated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.