vue本地环境请求线上django后端没有cookie

1、django安装django-cros-headers,settings配置:

INSTALLED_APPS = [
    'corsheaders',
    ...
]
MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    ...
]
CORS_ALLOW_CREDENTIALS = True
CORS_ORIGIN_ALLOW_ALL = True

2、axios请求默认 withCredentials: true

posted @ 2021-05-20 13:36  Maltone  阅读(242)  评论(0)    收藏  举报