You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by sad man <as...@gmail.com> on 2016/06/11 15:50:30 UTC

[users@httpd] Apache redirection using http response headers

I want to force the user browser to use https URL when accessing my server
(even if the user enters http URL). I have done redirections using
"redirect" & "rewrite" but would also like to use this method.


I load the headers module and add the following to
my /etc/apache/sites-enabled/example.conf

Header set Location https://www.example.com/
Header set X-Forwarded-Proto: https
Header set Strict-Transport-Security "max-age=180; includeSubdomains"

Although the server receives a the headers I set there is no redirection
(default apache page is shown). Is there anything else I need to do so that
the browser receives a http response from my server and automatically
changes the http request to https?

-- 
Cheers,

Asad

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: [users@httpd] Apache redirection using http response headers

Posted by Eric Covener <co...@gmail.com>.
On Sat, Jun 11, 2016 at 11:50 AM, sad man <as...@gmail.com> wrote:

> Header set Location https://www.example.com/
> Header set X-Forwarded-Proto: https
> Header set Strict-Transport-Security "max-age=180; includeSubdomains"
>
> Although the server receives a the headers I set there is no redirection
> (default apache page is shown). Is there anything else I need to do so that
> the browser receives a http response from my server and automatically
> changes the http request to https?
>

Remove the first two and just redirect.
​

-- 
Eric Covener
covener@gmail.com