2019/11/06 TIL

HANJIN·2019년 11월 6일
0

TIL

목록 보기
9/14
post-thumbnail

쿠키 설정 안됨

Problem
Client에서 Server로 http request를 날렸을 때,
Server측에서 쿠키를 설정해주었지만, Client측에 쿠키가 설정이 안되어있음.

Cause
Client에서 http request를 할 때(fetch, axios) 쿠키를 주고 받으려면 옵션이 필요함.

solution

// using axios
axios
  .post('endpoint',
           body,
           { withCredentials: true }
       )
  
// using fetch
fetch('endpoint', {
  method: 'POST',
  body: $body,
  credentials: 'include'
})

브라우저에서 쿠키 확인되지만, document.cookie로 접근 불가

Problem
Client에서 Server로 http request를 날렸을 때,
Server측에서 쿠키를 설정해주었고, 브라우저에서 쿠키가 존재하는 걸로 확인되지만,
document.cookie로 쿠키 값에 접근이 불가능함.

Cause
Server에서 쿠키를 보내줄 때, httpOnly를 설정하면 클라이언트측에서 javascript를 이용하여 접근이 불가능함.

mysql character-set 확인하기

show variables like 'c%';

status

mysql character-set 변경하기 ( 한글 깨질 시 )

vi편집기를 이용해 /etc/mysql/my.cnf 파일에 추가

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

설정 후 재시작
sudo service mysql restart

profile
소프트웨어 엔지니어.

0개의 댓글