Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
Sending HTTP request from mobile phone does not work like desktop (sending 'OPTIONS' instead of 'POST)

I have a dashboard that works by sending APIs to other parts of my server. It's a simple html form that is processed with JavaScript to send a fetch request, and the sent request is handled by my flask backend to do the task with the provided data.

The issue is that when the request is sent on desktop, it works properly. When I am sending it in iPhone using google chrome, the request is not sent properly. Instead of a 'POST' request, it is sending an 'OPTIONS' request.

Server logs show: "OPTIONS /api/message HTTP/1.1" vs desktop version of "POST /api/message HTTP/1.1"

Here is the JavaScript code:

  const options = {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify( params )  
  };
  fetch('https://myUrl.com/api/message', options )
      .then( response => response.text() )
        .then(response => {
          if (response == 'SUCCESS') {
            console.log(response)
            sessionStorage.setItem("success", "true"); 
            window.location.reload()
          } else {
            sessionStorage.setItem("error", response)
            window.location.reload()
          }
      })
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

My guess is that the browser sends a preflight request.

Different behaviour on desktop & phone might be explained by some phone-only optimizations implemented by browser's vendor.

about 4 years ago · Juan Pablo Isaza Denunciar

0

It is sending a preflight request. I believe this is because I was using the HTTP instead of HTTPS and the request sends to HTTPS.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda