Replies: 2 comments 2 replies
-
@dekobon @shawnhankim Do you guys please have any advice on this? |
Beta Was this translation helpful? Give feedback.
2 replies
-
I managed to enable Basic Auth by adding these lines to auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd; This works because the modified file is included in the # /etc/nginx/conf.d/default.conf
...
server {
include /etc/nginx/conf.d/gateway/server_variables.conf;
...
} Additionally, you don't have to reset the # /etc/nginx/conf.d/default.conf
server {
location @s3PreListing {
...
# Set the Authorization header to the AWS Signatures credentials
proxy_set_header Authorization $s3auth;
...
}
location @s3Directory {
...
# Set the Authorization header to the AWS Signatures credentials
proxy_set_header Authorization $s3auth;
...
}
location ~ /index.html$ {
...
# Set the Authorization header to the AWS Signatures credentials
proxy_set_header Authorization $s3auth;
...
}
} It is a bit of a hacky solution, but it works 🤷 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using this repo for hosting Nginx-s3-gateway inside a docker image: https://github.com/nginxinc/nginx-s3-gateway
I can get the s3 objects on browser after running the docker image but I need to authenticate it also , added auth _basic section in config but unable to use the authentication functionality supported by nginx itself.
/etc/nginx/default.conf
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
After I use this auth_basic module , browser prompts for username and password and then auto redirects to 404 page not found.
@liam from nginx community suggested this:
You should add those directives to the location block that is handling the S3 traffic. Don’t create a new location block for it.
No luck here as well.
Please help or give your suggestions
Beta Was this translation helpful? Give feedback.
All reactions