Skip to content

Commit

Permalink
feature: 외부에서 호출이 불가능하도록 보안 추가
Browse files Browse the repository at this point in the history
- 지정한 헤더가 존재하지 않을 경우 403 반환
  • Loading branch information
LuizyHub committed Aug 15, 2024
1 parent 646d600 commit f15d890
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nginx/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
snippets/managed-by-Certbot.conf
snippets/private-ip.conf
snippets/private-ip.conf
snippets/auth-value.conf
12 changes: 12 additions & 0 deletions nginx/sites-available/default
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ server {
# managed by Certbot
include /etc/nginx/snippets/managed-by-Certbot.conf;

include /etc/nginx/snippets/auth-value.conf;

set $auth_allowed 0;

if ($http_auth = $auth_secret_value) {
set $auth_allowed 1;
}

if ($auth_allowed = 0) {
return 403; # 인증 실패 시 403 Forbidden 반환
}

location /count {
content_by_lua_block {
-- access.log의 라인 수를 세어 successCount로 사용
Expand Down

0 comments on commit f15d890

Please sign in to comment.