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

118
Views
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 answers
Answer question

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 Report

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 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!