0

When I'm trying to access the web interface of arangoDb behind a nginx reverse proxy I'm getting a 401 Unauthorized reponse

This is my current nginx configuration

location /db/bnf/ {
   auth_basic off;
   proxy_pass http://172.28.1.3:8529/;  
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Host $host:$server_port;
   proxy_set_header X-Forwarded-Proto $scheme;
}

The auth_basic off; is used here because of I already have security at the root of the server (.htpasswd method) I've tried with and without it

I'm able to access the login page via

http://something/db/bnf/_db/_system/_admin/aardvark/index.html#login

But then when I'm trying to login for exemple :

POST https://something/_db/_system/_open/auth

The post url seems wrong to me and should be

https://something/db/bnf/_db/_system/_open/auth

The arango conf file is set to default. I have read the documentation but they are only talking about Foxx services.

Any help would be greatly appreciated

Theo
  • 473
  • 8
  • 20
  • Read [this](https://stackoverflow.com/questions/53649885/a-little-confused-about-trailing-slash-behavior-in-nginx) Q/A. – Ivan Shatsky Dec 03 '20 at 16:54

1 Answers1

1

Update

actually there is a way to serve frontend via custom path, I wasn't aware of it as I didn't find it in documentation, but then I dug in code and found issue respect x-script-name header when calculating the initial redirect into aardvark

what you need to do is

  • start arangod with --frontend.trusted-proxy set to ip of your proxy server
  • add in location in nginx conf proxy_set_header X-Script-Name /db/bnf;
  • access admin ui via full path /db/bnf/_db/_system/_admin/aardvark/index.html cause initial redirect doesn't work viz mentioned issue

when all set correctly you'll see your /db/bnf under basePath in /_db/_system/_admin/aardvark/config.js


ArangoDB web server serves everything via path starting /_db/..., same path is hardcoded in UI, that's why you see that login POST to /_db/... and that's why you need change in nginx config your location /db/bnf/ to location /_db

sevcik.tk
  • 514
  • 4
  • 7
  • I get that, but this is not what I want. I'm looking for a way to bypass that either in Arango Web Server conf or using nginx – Theo Dec 04 '20 at 09:29