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

375
Views
Apache HTTPD: PATCH request returns 404

I'm working on a web application that interacts with a custom REST API. It's basically a table of data that's updated through the application. I'm trying to use the PATCH method for the updates, but Apache is returning a 404 error when I send the request.

The weird thing is that a GET request to the same URL (i.e. pasting the URL into a separate browser window) works fine. Some details:

  • It appears that Apache is blocking the request before it gets to the custom REST API. I can see both PATCH and GET requests in the Apache access logs, but only the GET request appears in the custom REST API log (FWIW, the custom REST API is implemented in Flask) using Gunicorn as a hosting server.

    Example Apache access log records:

    192.168.0.1 - unknown [27/Aug/2021:18:23:27 +0000] "PATCH /admin-api/services/12872 HTTP/1.1" 404 14 "https://www.example.com/admin-dashboard/" ...

    192.168.0.1 - adminuser [27/Aug/2021:18:23:43 +0000] "GET /admin-api/services/12872 HTTP/1.1" 200 988 "-" ...

  • One thing I noticed is that the PATCH request is replacing the username with "unknown". This lead me to believe that something was wrong with CORS. I found a "Header" configuration that was missing OPTIONS and PATCH so I added them. Still seeing the same issue. Below is the current configuration of the option:

    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, PATCH"
    
  • I'm not seeing a pre-flight OPTIONS requests in the Apache logs or browser console window. I've tried with Google Chrome (92.0) and Firefox (91.0).

  • The PATCH requests have the "access-control-allow-origin" header set to "POST, GET, OPTIONS, PATCH"

  • Apache proxy configuration uses a Unix socket to proxy to Gunicorn:

    <Location /admin-api>
      ProxyPass unix:/run/admin-api.sock|http://127.0.0.1
    </Location>
    
  • JavaScript fetch request: (apiUrl and id are variables set earlier in the function):

    let resp = await fetch(`${apiUrl}/services/${id}`, {
       credentials: "include",
       method: "PATCH",
       headers: {
         "Content-Type": "application/json",
         Accept: "application/json",
       },
       body: JSON.stringify({
         data: { min: 1, max: 3 },
       }),
     });
    
over 4 years ago · Santiago Trujillo
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!