公開前で認証かけときたいけどOGPのチェックはしたいときに
server {
set $auth "Restricted";
if ($http_user_agent ~ (Twitterbot|facebookexternalhit)) {
set $auth off;
}
location / {
auth_basic $auth;
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
公開前で認証かけときたいけどOGPのチェックはしたいときに
server {
set $auth "Restricted";
if ($http_user_agent ~ (Twitterbot|facebookexternalhit)) {
set $auth off;
}
location / {
auth_basic $auth;
auth_basic_user_file /etc/nginx/.htpasswd;
}
}