1

I have spent almost a day without any solution to this problem. I have applied all the solutions suggested by different folks on different forums.

Recently we have upgraded the Python version of our project from 3.5 to 3.9. Upgraded Django version from 1.8 to 3.2.0.

Post that this CORS issue is coming. It is working fine on my local MacBook. But when we deploy it on the Cent OS server, this issue starts appearing.

in my settings.py I have added -

MIDDLEWARE = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'corsheaders.middleware.CorsMiddleware',  # must be before CommonMiddleware
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.common.CommonMiddleware',
    'corsheaders.middleware.CorsPostCsrfMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'reversion.middleware.RevisionMiddleware',
    'insights.middleware.RaiseErrorMiddleware',
    'insights.middleware.IAMAuthenticationMiddleware',

) + getattr(settings_local, 'LOCAL_MIDDLEWARE', ())

==============

CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = True
CORS_ALLOW_METHODS = [
    "DELETE",
    "GET",
    "OPTIONS",
    "PATCH",
    "POST",
    "PUT",
]
CORS_ALLOW_HEADERS = [
    "accept",
    "accept-encoding",
    "authorization",
    "content-type",
    "dnt",
    "origin",
    "user-agent",
    "X-csrftoken",
    "X-Requested-With, Content-Type",
    "X-requested-with", "X-I-Token", "x-employer-key"
]

Below is our server configuration.

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"

Can anyone please help. me with the solution.

Update 1: Error Message:

enter image description here

enter image description here

sandeep
  • 3,061
  • 11
  • 35
  • 54

0 Answers0