Apache 2.4: this worked for me: deny everything first then grant selectively.
ProxyRequests On
ProxyVia Off
AllowCONNECT 443 563 80
<Proxy *>
Require all denied
</Proxy>
<ProxyMatch "^https?://[a-z]*\.?google\.com.*$">
Require all granted
</ProxyMatch>
<ProxyMatch "^[a-z]*\.?google\.com:443$">
Require all granted
</ProxyMatch>
Note the second ProxyMatch (with the :443) is required for HTTPS because else your request gets:
Received HTTP code 403 from proxy after CONNECT
meaning your https went through, but the SSL tunnel is rejected.
This works with Apache listening on :80, using the following request
curl -x localhost:80 "https://www.google.com?q=mod_proxy&language=de"
but not with
curl -x localhost:80 "https://www.bing.com?q=google.com"
which is essential, because otherwise you can circumvent the whitelisting by means of a bogus querystring parameter.