I need help to understand how to do HTTP redirects to HTTPS when using apache-fpm in DDEV.
T3 site config.yaml
base: 'https://sample-project.ddev.site/'
ddev config.yaml
name: sample-project
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
use_dns_when_possible: true
that works fine when calling in safari https://sample-project.ddev.site/ but when calling in safari sample-project.ddev.site it does not work I get an T3 oops so I have inserted in .htaccess (equivalent to my hosting server)
RewriteCond %{HTTPS} !off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [L,R=301]
now safari moans too many redirects and I wonder where these redirects come from and why, no redirects in T3 backend are set, no further changes to .htaccess vs the original T3 .htaccess I was expecting ddev to simply redirect sample-project.ddev.site to https://sample-project.ddev.site/
Please use this redirect. Since ddev-router is terminating HTTPS, it sets X-Forwarded-Proto, but the ddev-webserver (where you are putting the rule) is actually getting the traffic via HTTP.
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]