公開前で認証かけときたいけど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;
}
}
More than 3 years have passed since last update.
公開前で認証かけときたいけど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;
}
}
Register as a new user and use Qiita more conveniently