Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use HTTP Basic Authentication with nginx #139

Open
bmp opened this issue Jun 11, 2024 · 2 comments
Open

Unable to use HTTP Basic Authentication with nginx #139

bmp opened this issue Jun 11, 2024 · 2 comments

Comments

@bmp
Copy link

bmp commented Jun 11, 2024

Describe the bug

A clear and concise description of what the bug is.

Context

  • Hardware: Raspberry Pi at home
  • YunoHost version: 11.2.14 (testing).
  • I have access to my server: Through SSH & through the webadmin
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no
    • If yes, please explain:
  • Using, or trying to install package version/branch:
  • If upgrading, current package version: can be found in the admin, or with yunohost app info $app_id

Steps to reproduce

  • Installed the application and am able to get the index page with the cat animation.
  • Followed the steps in the Admin doc to add basic HTTP authentication, i.e, modified /etc/nginx/conf.d/[redacted].com.d/my_webapp.d/my_webapp.conf with
    location /notes {
      auth_basic           "Administrator’s Area";
      auth_basic_user_file /etc/apache2/.htpasswd;
    } 
    
    I have also followed the guide , to create a password in the location visible above. I then reloaded nginx using nginx -t.
  • Go to [redacted.com]/notes, and there is a prompt for user name and password
  • I am unable to login with the password I had used for used in the htpasswd command to store the password in /etc/apache2/.htpasswd

Expected behavior

The index page should be shown after the correct password has been entered.

If applicable and useful, add screenshots to help explain your problem.
Screenshot_20240611_172931
Screenshot_20240611_173020

@bmp
Copy link
Author

bmp commented Jun 15, 2024

Sorry, is there any other place I can reach out or read any documents to check if i am doing something wrong?

@Caliandroid
Copy link

Caliandroid commented Jul 7, 2024

Hi,
the best place would be the yunohost forum.

I can deliver a temporary solution.
Your http basic auth seems ok.

What you need to do (and re-do after every yunohost update and every time, yunohost app ssowatconf has been executed <= this happens frequently):

  1. Open /etc/ssowat/conf.json
  2. Search for your my_webapp.mai block
  3. set auth_header und use_remote_user_var_in_nginx_conf to false
"my_webapp.main": {
            "auth_header": false,
            "label": "Demo Site",
...
...
  "use_remote_user_var_in_nginx_conf": false,
  1. sudo systemctl restart nginx

By the way:
I'm currently searching for a permanent way to limit the access to a certain subfolder of a my_webapp site via SSOWAT yunohost permissions (visit the forum :) ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants