Skip to content

Commit

Permalink
✨ feat : 쿠키 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
chaeunho1227 committed May 27, 2024
1 parent 08dc650 commit 71029e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion booth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def likes(self, request, pk=None):
booth_like = BoothLike.objects.create(booth=booth, key=key, fingerprint=fingerprint)
serializer = LikeSerializer(booth_like)
response = Response(serializer.data)
response.set_cookie(booth_id, key, max_age=5*24*60*60, httponly=True)
response.set_cookie(booth_id, key, max_age=5*24*60*60, httponly=True, secure=True, samesite=None)
return response

elif request.method == 'DELETE':
Expand Down
10 changes: 9 additions & 1 deletion festival/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,12 @@
'comments' : '60/minute',
'likes': '100/minute',
}
}
}

# CSRF 쿠키 설정
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_SAMESITE = 'None'

# 세션 쿠키 설정
SESSION_COOKIE_SECURE = True
SESSION_COOKIE_SAMESITE = 'None'

0 comments on commit 71029e6

Please sign in to comment.