I've set up a general http to https redirect in my ubuntu virtual host file as shown below:
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
#UseCanonicalName Off
#ServerName test.example.com
#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/test.example.com/web
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
<VirtualHost *:443>
UseCanonicalName Off
ServerName test.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.example.com/web
SSLEngine on
SSLCertificateFile /etc/ssl/bcerts/b.crt
SSLCertificateKeyFile /etc/ssl/bcerts/b.key
SSLCertificateChainFile /etc/ssl/bcerts/b.ca-bundle
</VirtualHost>
The above confirguration works fine except I have http POST requests that aren't SSL coming from an iOS app that get converted into http GET requests (presumably because a 302 request will always do this). However, I need the apache config to allow for http POST requests to remain http POST requests without changing the iOS app code. Any configuration that allows this?