Problem making a GET on my site when it is entered via www (react + django)

0

I have a django application that uses React on some of its pages (not two separate servers). In my pages in React, I make HTTP requests to django by api using Django Rest Framework.

This application is already in the air, and in it I noticed a problem. If I enter the site without "www", log in normally and access the pages via react, everything works perfectly.

However, when I use "www" to access the site, it first redo me login (it does not save that I was already logged in) and also, when accessing the pages in react, the GET request gives the error 403 , that credentials were not provided, however, without the "www" function normally.

Follow DRF data in settings.py:

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication',
    ),
'DEFAULT_PERMISSION_CLASSES': [
    'rest_framework.permissions.IsAuthenticated',
],
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',)

}

I really do not know if it is a DRF problem, something that was missing from the request, or some HTTPS redirect problem.

Would anyone have any idea what it could be? Thanks!

    
asked by anonymous 10.10.2018 / 21:48

0 answers