I'm trying to get my head around why this would be happening. I've never had problems on this server around this, so I'm a bit baffled.

The server is nginx + Apache 2.4 reverse proxy. So nginx I have this proxy pass:

    location ~ \.cgi$ {
        try_files $uri =404;
        gzip off;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;


Then for the domains in Apache config I have:

<VirtualHost *:8181>

    # other stuff here

    <Directory "/the/web/directory/*">
        Options +ExecCGI +FollowSymLinks +MultiViews
        AllowOverride AuthConfig
        Require all granted
        AddHandler cgi-script .cgi .pl


The domain is enabled and running fine normally. However, when developing a site for someone I just came across a weird error.

Every now and then the page gives a 404:

enter image description here

..yet the rest of the time it works fine. In this instance I was sending the exact same params to it (just re-submitting the form). I have checked to see if the problem is with AJAX request, but I get the same problem if I open the URL up in a tab and press reload a few times to test.

Nothing helpful comes up in Apache log file:

authorization result of <RequireAny>: granted, referer: https://x.co.uk/contact.html

I'm pretty confident the error is coming from the Apache end, as the response for the 404 is:

Not Found

The requested URL /cgi-bin/contact.cgi was not found on this server.
Apache/2.4.18 (Ubuntu) Server at x.co.uk Port 8181

I'm at a bit of a loss as to what this could be. Any ideas?


Mmmm weird - scrap that. I gave it a reboot and it all works fine now! Very odd how no error messages were in the domains error log - nor the main Apache error log (in /var/log)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.