Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

130
Visualizações
Strange Ajax request in Firefox

I have a strange behavior with a particular ajax request in my code. The javascript code generating the request is the following:

$.ajax({
    method: "GET",
    url: "https://YYY/ZZZ/",
    contentType: "application/json",
    cache: false,
    data: {},
    username: "AAA",
    password: "BBB"
})

This request fails with an error set to "error" (no additional detail is given); it is not a CORS issue and the server does not receive any request at all. Using the Firefox debugger (in particular looking at the "Network" tab), I can only see that the request is blocked. If I look at the raw request, i see the following:

GET XXX undefined
Host: YYY
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0
Accept: */*
Accept-Language: it
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
Referer: http://localhost:10000/

You can notice that instead of the usual HTTP/1.1 field in the GET request, there is a weird "undefined" http version. I have no clue how that is possible. If I resend the request using the Firefox debugger (select the request in the "Network" tab, right click on it, choose "Resend"), the second request appears as follows:

GET XXX HTTP/1.1
Host: YYY
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0
Accept: */*
Accept-Language: it
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:10000/
Content-Type: application/json
Connection: keep-alive
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: no-cors
Sec-Fetch-Site: cross-site
Pragma: no-cache
Cache-Control: no-cache

Now, the http version is correctly "HTTP/1.1" but not because of a modification on the code, just a resend action using the Network tab of the Developer tools.

Moreover, if I execute the same code using Chrome, the request appears to be different again:

GET XXX HTTP/1.1
Host: YYY
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en;q=0.8,fr;q=0.7

I'm developing on a Linux Ubuntu machine, my Firefox version is 95.0.1 (64 bit), while my Chrome version is 96.0.4664.110 (Official Build) (64-bit).

My bet is that the origin of the trouble is due to the fact that in the first Firefox request, the http version is "undefined" instead of "HTTP/1.1", but I have not found any way to force a different value, and I don't understand what causes such error.

Thanks in advance to whoever may provide any clue.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda