2017-08-07 18:42 GMT+03:00 Philippe Busque <pbusque@xxxxxxxxxxxxx>: > Hello, > I have a configuration question regarding RewriteRule. > > We have a SSL terminator in front of our Apache, which redirect traffic to > different port based virtual host depending on which protocol the connection > came from. > As a result, Apache is only responding to HTTP requests. > > We have RewriteRule that perform relative 301 and 302 redirections. > > Exemple: RewriteRule ^/deprecatedPage.html$ / [R=301,L,E=nocache:1] > > According to the documentations: > "If a fully-qualified URL is specified (that is, including > http://servername/) then a redirect will be issued to that location. > Otherwise, the *current protocol*, servername, and port number will be used > to generate the URL sent with the redirect. " > > Because of the current protocol clause, all URL that are sent to a https > address are redirected back to http. We have a catch all http to https > redirection too, but that cause two redirections in a row we would like to > avoid. > > Other than inputing the absolute URL to the destination, is it possible to > change the 'current protocol' so that mod_rewrite put https rather than > http? > > I tried SetEnv SERVER_PROTOCOL=https without success. It sounds similar to the question that I answered in January: http://markmail.org/message/a43q65rmszqf5t4j Configuring redirects httpd behind a TLS-terminating proxy Jan 23, 2017 2:07:13 pm Solved by configuring ServerName to include https protocol. http://httpd.apache.org/docs/2.4/mod/core.html#servername Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx