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

502
Visualizações
My API URL Have backslashes (\x01\x02) causing apache 400 error. How to remove those backslashes from the url

I am managing an application that gets requests through API. Some of the requests are having invalid characters. The Request URL/API looks like:

/up/100.php?f=0&t=n\x01\x02&...

These \x01\x02 causing Apache2 to throw 400 errors. I can't change/alter the URL. I need to fix my apache to accept and process that URL. I tried mod_rewrite but couldn't found the correct one.

Any Help?

Update and Solution

Now, I found that the request is really a malfunctioned URL. So, what I did to solve the problem? I've created a custom error handling page to sanitize the URL and make it work.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Try the following at the top of your .htaccess file:

RewriteEngine On
RewriteCond %{QUERY_STRING} (.*)\\x01\\x02(.*)
RewriteRule ^up\.php$ /$0?%1%2 [R,L]

The double backslash in the CondPattern is necessary to match a single backslash in the query string, since the backslash is used as the escape character in PCRE regex.

The %1 and %2 backreferences match the characters either side of the sequence you want to remove. $0 is just a backreference to the matched URL-path (saves repetition).

HOWEVER, a request of the form /up.php?f=0&t=n\x01\x02&... would not ordinarily trigger a 400 response. The character sequence \x01\x02 in the URL is just a literal character sequence: \, x, 0, 1, etc. (it's not an encoded character in this context).

So, if you are getting a 400 response, it's possible that something else (a mod_security rule perhaps?) is triggering this response - which maybe out of your control?

over 4 years ago · Santiago Trujillo Relatório
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