I have two servers which have the same URL but the port number may change.
I want to redirect these two URLs HTTPS.
If I enter my first URL (http://example.com
) then I want to it will redirect to https://example.com
.
If I enter second URL (http://example.com:8080
) then I want to it redirect to https://example.com:8080
.
See My Configurations:
frontend www-HTTP
bind *:80
bind *:443 ssl crt /etc/apache2/ssl/apache.pem
reqadd X-Forwarded-Proto:\ https
default_backend tcp-backend
mode tcp
frontend TCP-HTTP
bind *:8080
bind *:8443 ssl crt /etc/apache2/ssl/paritech.pem
reqadd X-Forwarded-Proto:\ https
default_backend www-backend
mode tcp
backend www-backend
redirect scheme https if !{ ssl_fc }
server dev.example.com 192.168.1.120:8080 check
backend TCP-backend
redirect scheme https if !{ ssl_fc }
server qa.example.com 192.168.1.120:80 check
How can I redirect 8080 over 8443 for HTTPS..