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

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

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