Search code examples
apachehttpd.conf

Getting net::ERR_EMPTY_RESPONSE on local apache setup


I am developing a web app locally which makes API calls. Some of the API calls have suddenly stopped working, while others continue to work. If I go directly to an api endpoint in my browser, the first time it always returns:

This page isn’t working
samplesite.com didn’t send any data.
ERR_EMPTY_RESPONSE

The request headers are:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Cookie: PHPSESSID=xxx; _ga=GAxxx; _gid=GAxxx; __stripe_mid=xxx; __stripe_sid=xxx
Host: samplesite.com
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36

An error appears in my apache log:

[Mon Jan 20 22:10:18.133644 2020] [core:notice] [pid 4702] AH00052: child pid 6191 exit signal Segmentation fault (11)
[Mon Jan 20 22:14:02.343396 2020] [core:notice] [pid 4702] AH00052: child pid 6241 exit signal Segmentation fault (11)
[Mon Jan 20 22:14:02.343886 2020] [core:notice] [pid 4702] AH00052: child pid 6240 exit signal Segmentation fault (11)
[Mon Jan 20 22:14:07.349923 2020] [core:notice] [pid 4702] AH00052: child pid 6212 exit signal Segmentation fault (11)

Trying to get details on the process does not return any results:

alan:~$ ps -p 6212
PID TTY           TIME CMD

If I refresh the page, the second time (and all additional times) it will return the proper data (for testing I made the api endpoint simply output "hello world").

To resolve I tried:

  • restarting apache
  • clearing browser cache
  • making the request in incognito mode
  • in Firefox, Safari and Chrome

I just updated to Catalina but don't think this is related, as I believe I had this error before and it went away on its own.

Any suggestions? Thank you.


Solution

  • Reading the error in Firefox provided a bit more of a clue. Firefox's error said:

    Secure Connection Failed: The page you are trying to view cannot be shown because the authenticity of the received data could not be verified
    

    So for some reason there is an SSL problem. I had locally created a self-signed SSL certificate for testing (supporting wildcard subdomains); it had not expired so I'm not sure why it is a problem all of a sudden.

    Solution: do not use https locally and update my .htaccess files to only force https on the live site (mysite.com) and not the dev site (mysite.test):

    RewriteEngine On
    
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} mysite.com$
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

    I also uninstalled Apache and OpenSSL, but I don't think that is what resolved it.