Thanks in advance for any suggestions...Paul..Normally, this wouldn't be an issue, but I need to be able to run this VirtualHost on a port other than 80.As you can see, a '/' is being prepended to the rewritten URL and recursion occurs which eventually causes the URL to become too long and cause an error. Why does specifying the port in the URL cause mod_rewrite to behave differently? Is there a better way for me to do this?However, when the port is specified ( http://xenial.localdomain:80 ), the redirect does not work as expected. I see the following in my logs:With this RewriteRule, the redirection that I want (to my SSL VirtualHost listening on port 443) is working just fine as long as the client uses http://xenial.localdomain as the URL:Hello..I'm seeing an issue where mod_rewrite seems to behave differently when the client connects to my VirtualHost and includes the port as a part of the URL. i.e. http://xenial.localdomain vs. http://xenial.localdomain:80
RewriteRule ^/?(.*) https://%{HTTP_HOST}:443/$1 [R=301,L]
192.168.122.1 - - [06/Mar/2017:18:57:58 +0000] "GET / HTTP/1.1" 301 595 "-" "Links (2.13; Linux 4.8.13-100.fc23.x86_64 x86_64; GNU C 5.3.1; text)"
192.168.122.1 - - [06/Mar/2017:18:57:58 +0000] "GET /https://xenial.localdomain:80:443/ HTTP/1.1" 301 662 "-" "Links (2.13; Linux 4.8.13-100.fc23.x86_64 x86_64; GNU C 5.3.1; text)"
192.168.122.1 - - [06/Mar/2017:18:57:58 +0000] "GET /https://xenial.localdomain:80:443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ HTTP/1.1" 301 798 "-" "Links (2.13; Linux 4.8.13-100.fc23.x86_64 x86_64; GNU C 5.3.1; text)"
192.168.122.1 - - [06/Mar/2017:18:57:58 +0000] "GET /https://xenial.localdomain:80:443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/ HTTP/1.1" 301 1070 "-" "Links (2.13; Linux 4.8.13-100.fc23.x86_64 x86_64; GNU C 5.3.1; text)"
192.168.122.1 - - [06/Mar/2017:18:57:58 +0000] "GET /https://xenial.localdomain:80:443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ https://xenial.localdomain:80: 443/https://xenial. localdomain:80:443/https:// xenial.localdomain:80:443/ HTTP/1.1" 301 1614 "-" "Links (2.13; Linux 4.8.13-100.fc23.x86_64 x86_64; GNU C 5.3.1; text)" ---
Paul B Schroeder <paul.schroeder "at" nimbix "dot" net>