[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: https to http




On Fri, 24 Oct 2008 20:21:18 +0200, "Andrea Ganduglia"
<nonews.org@gmail.com> wrote:
> Hi, how can I redirect HTTPS requests to HTTP?
> 
> https://www.domain.com => http://www.domain.com
> 
> A simple iptables port redirection
> 
> iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT
> --to-port 80
> 
> allow client connections, but drop request.
> 
> How Can I solve this?
> 


If you're using Apache, you can use mod_rewrite to rewrite https to http
requests. I'm doing the exact opposite using this rule:


RewriteEngine   on
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
RewriteRule     ^/$ https://%{SERVER_NAME}/ [L,R]

Enable the module using "a2enmod rewrite". Adapt the above example
appropriately.


Reply to: