2

I'm new to Nginx and EC2 and trying to add some simple authentication as below. It's a one page app and i want to secure the access to the page but not the tile server. With no authentication all works well. With authentication as the below I get back an error saying;

http://map.domain.org.uk is requesting your username and password. The site says: “GeoServer Realm”

I think this is because I've set authentication for any location and the tiles sit under that. How would I set up to just require authentication for the equivalent of a landing page?

server {
    listen 80;
    listen [::]:80;

    root /var/www/domain.org.uk/public_html;

    index index.html;

    server_name domain.org.uk www.domain.org.uk map.domain.org.uk;

    access_log /var/log/nginx/domain.org.uk.access.log;
    error_log /var/log/nginx/domain.org.uk.error.log;

  # auth_basic "Server level Password required to proceed";
   # auth_basic_user_file /etc/nginx/conf.d/.htpasswd;

    location /geoserver/gwc/service/wmts {
      auth_basic off;
#also tested without auth_basic off;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://localhost:8080/geoserver/gwc/service/wmts;
    }


    location / {
        try_files $uri $uri/ =404;
    auth_basic "Location level Password required to proceed";
   auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
    }

}



mapping dom
  • 1,737
  • 4
  • 27
  • 50

1 Answers1

0

Try running http://localhost:8080/geoserver/wms?request=GetCapabilities

Also, I think This is useful for you in this case.

This uses curl utility to issue HTTP requests that test authentication. Install curl before proceeding.

Also, check /etc/nginx/sites-available/example.com Here on Linode.

Example

upstream appcluster{ server linode.example.com:8801; server linode.example.com:8802 weight=1; }

champion-runner
  • 1,489
  • 1
  • 13
  • 26
  • Thanks but as OP I know that the request is fine without authentication so this is not the error, it's a config setting for geoserver of nginx that I need to understand – mapping dom Nov 18 '19 at 11:14