I'm trying to redirect a Django View function to a PHP page, currently hosted on my own machine.
The fact is that I have seen that it gives me a domain crossing error because I am calling another link from my own team.
I have found a module called django-cors-headers and I have configured it as it comes in the documentation https://github.com/ottoyiu/django-cors-headers
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
]
CORS_ORIGIN_ALLOW_ALL = True
CORS_ALLOW_CREDENTIALS = False
Then at the end of the function I pass the url but it still gives me the same error
return HttpResponseRedirect('http://localhost/pruebas/prueba.php',{'datos':datos})
and this is the answer:
Solicitud desde otro origen bloqueada: la política de mismo origen
impide leer el recurso remoto en http://localhost/pruebas/prueba.php
(razón: falta la cabecera CORS 'Access-Control-Allow-Origin').
You're doing it backwards, CORS works like this:
In this scenario, it is B who has to implement CORS to explicitly accept calls from server A's code.