Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

378
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda