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

825
Views
El campo de encabezado de solicitud Pragma no está permitido por Access-Control-Allow-Headers en la respuesta de verificación previa

Recibo este error cuando intentaba mantener el siguiente código para deshabilitar el caché para ajax

 angularApp.config(['appConfig', '$httpProvider', function (appConfig, $httpProvider) { if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } //disable IE ajax request caching $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache'; }]);

Recibo un error en Chrome de la siguiente manera:

El campo de encabezado de solicitud Pragma no está permitido por Access-Control-Allow-Headers en la respuesta de verificación previa.

Pero cuando elimino el siguiente código, funciona bien.

 $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';

alguien me puede decir cual puede ser el problema?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si puede configurar en el lado del servidor para aceptar esos encabezados, entonces está bien. De lo contrario, debe eliminar los encabezados que se establecen en $httpProvider.defaulsts. Verifique el código a continuación:

 var data = {} var httpCoonfig = { headers: {'Pragma': undefined, 'Cache-Control': undefined, 'X-Requested-With': undefined, 'If-Modified-Since': undefined} }; $http.post('https://www.google.com/', data, httpCoonfig).then(function(response){ // console.log(response) }, function(response){ console.log(response) });
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!