I want to be able to redirect all traffic from http to https on our apache config, except for if the incoming request is from a specific source (in this case, it's originating from the same IP as the server).
Context: we have a Zend server running a php application with an apache config, and the same Zend server is also running a Job Queue which runs a http job to one of our REST endpoints. Obviously, we can't route this over https as it's internal traffic, but i'm not sure how to structure our RewriteConds so that it will correctly fall through and serve http only for that specific requester, but https for everyone else.
Here is the cond at the moment - i'm really not all that familiar with Apache syntax, but I've got to work with what I know ;)
<VirtualHost *:80>
TimeOut 5600
ServerName <name>
ServerAlias <alias>
RewriteEngine On
RewriteCond %{HTTP_HOST} !=example\.com\:80
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
DocumentRoot <docroot>
RewriteCond %{REQUEST_URI} !^(/index\.php|/favicon\.ico|/robots\.txt|/a/css(.*)|/a/js(.*)|/a/i(.*)|/alive\.html)
RewriteRule ^(.*)$ /index.php/$1 [L]
<Directory "<docroot>">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
TimeOut 12000
ServerName <name>
ServerAlias <alias>
DocumentRoot <docroot>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(/index\.php|/favicon\.ico|/robots\.txt|/a/css(.*)|/a/js(.*)|/a/i(.*)|/alive\.html)
RewriteRule ^(.*)$ /index.php/$1 [L]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "<docroot>">
Options All
AllowOverride All
Require all granted
</Directory>
SSLEngine on
...ssl etc
</VirtualHost>