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;
    }

}



1 Answer 1

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; }

1
  • 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 Nov 18, 2019 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.