It looks ok mostly, only this block is unknown for Apache:
- Code: Select all
<If "%{HTTP_USER_AGENT} == '^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$'">
Require all denied
</If>
You could use Rewrite Engine for that,
- Code: Select all
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$
RewriteRule .* "-" [F]
I did not check that big regular expression, i simply took it as provided. The [F] Flag causes a Denied Error 403.
A remark on VirtualHosts: if you are using at least one VirtualHost, you have to assign ALL hosts you need to a VirtualHost. Many people for example like to access "localhost" locally, and they have a ServerName entry in httpd.conf for localhost. This entry is void in case you have any VirtualHosts in your configuration, if you would like to access localhost, you MUST declare a VirtualHost for ServerName localhost as well (and define a DocumentRoot etc.). If you dont do so, Apache would not response to a request for "localhost" as you would expect - it would take the very first (and in your case the only) VirtualHost in your configuration, that is the Declaration for ServerName dock-sss.lab.sss.com.my. It would behave is if you requested for dock-sss.lab.sss.com.my
So if you like to access localhost as a different host, extend your VirtualHost declarations:
- Code: Select all
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Require All Granted
...
</Directory>
...
</VirtualHost>
<VirtualHost *:80>
ServerName dock-sss.lab.sss.com.my
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>