Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

512
Views
Prohibido (403) Verificación CSRF fallida. Solicitud abortada. Razón dada por la falla: la verificación del origen falló no coincide con ningún origen confiable

Ayuda

Razón dada por el fracaso:

 Origin checking failed - https://praktikum6.jhoncena.repl.co does not match any trusted origins.

En general, esto puede ocurrir cuando hay una verdadera falsificación de solicitud entre sitios, o cuando el mecanismo CSRF de Django no se ha utilizado correctamente. Para los formularios POST, debe asegurarse de lo siguiente:

 Your browser is accepting cookies. The view function passes a request to the template's render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login.

Está viendo la sección de ayuda de esta página porque tiene DEBUG = True en su archivo de configuración de Django. Cámbielo a Falso y solo se mostrará el mensaje de error inicial.

Puede personalizar esta página usando la configuración CSRF_FAILURE_VIEW.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

De hecho, CSRF_TRUSTED_ORIGINS en settings.py parece obligatorio desde Django 4.0.

over 4 years ago · Santiago Trujillo Report

0

Compruebe si está utilizando Django 4.0. Estaba usando 3.2 y tuve este descanso para la actualización a 4.0.

Si estás en 4.0, esta fue mi solución. Agregue esta línea a su settings.py . Esto no era necesario cuando estaba usando 3.2 y ahora no puedo PUBLICAR un formulario que contenga un CSRF sin él.

CSRF_TRUSTED_ORIGINS = ['https://*.mydomain.com','https://*.127.0.0.1']

Revise esta línea para conocer los cambios necesarios, por ejemplo, si necesita cambiar https por http .

La causa raíz es la adición de la verificación del encabezado de origen en 4.0.

https://docs.djangoproject.com/en/4.0/ref/settings/#csrf-orígenes-de-confianza

Cambiado en Django 4.0:

La verificación del encabezado de origen no se realiza en versiones anteriores.

over 4 years ago · Santiago Trujillo Report

0

Si su versión de django es "4.xx" :

 python -m django --version // 4.xx

Entonces, si el error es como se muestra a continuación:

No se pudo verificar el origen: https://example.com no coincide con ningún origen confiable.

Agregue este código a "settings.py" :

 CSRF_TRUSTED_ORIGINS = ['https://example.com']

En tu caso, tienes este error:

No se pudo verificar el origen: https://praktikum6.jhoncena.repl.co no coincide con ningún origen confiable.

Por lo tanto, debe agregar este código a su "settings.py" :

 CSRF_TRUSTED_ORIGINS = ['https://praktikum6.jhoncena.repl.co']
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!