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

Asked

Viewed 54 times

1

I have a Jango application that uses React on one of your pages (not two separate Servers). On my React pages, I make HTTP requests to Django for the 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, first it makes me re-log in (it doesn’t keep that I was already logged in) and also, when accessing the pages in React, the GET request gives the 403 error, that the credentials were not provided, however, without the "www" works normally.

Below is data on DRF 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 don’t really know if it’s a DRF problem, something that was missing from the request, or else some problem with the redirect to HTTPS.

Would anyone have any idea what it might be? Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.