Old 16th May 2006, 05:49
gabriele gabriele is offline
Junior Member
Join Date: Feb 2006
Location: Napoli
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default redirecting 80 to 443

I run debian sarge 3.1 2.6,apache-ssl and apache 1.3,my lan has a front modem-router,and a linuxbox gateway firewall attached to it,a switch,and 3 more servers,mail,www,icecast2.
I don't know what is wrong with my configuration both iptables and apache but i don't manage to redirect those people still connecting to 80 when i moved the server to 443 but worst ... tcpdumping tcp port 443 and ,from the laptop on the fron-router,ponting the browser to https://www.hardcode.ath.cx
root@argo:~# tcpdump tcp port 80 -n -vv
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
I have these iptables on the gateway machine:
$IPT -t nat -A PREROUTING -p tcp -i eth0 -d --dport 80 -j DNAT --to
$IPT -A FORWARD -i eth0 -o eth1 -p tcp -m state --state NEW -s $ARG0 --dport 443 -d -j ACCEPT
On the www machine iptables :
$ipt -t nat -A PREROUTING -i eth0 -p tcp -d --dport 80 -j REDIRECT --to-port 443
Apache has mod_rewrite to handle the rewriting of the url but ...
RewriteEngine On
RewriteCond %{SERVER_PORT} !=80
RewriteRule ^.* - [F]
RewriteRule ^(.*)$ https://www.hardcode.ath.cx/$1 [L,R]
Well!I know it's not enough to understand the origin of the problem but at the list how do these directives look ???

Last edited by gabriele; 16th May 2006 at 06:07.
Reply With Quote
Sponsored Links
Old 16th May 2006, 17:26
falko falko is offline
Super Moderator
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts

Have you tried

RewriteEngine On
RewriteCond %{SERVER_PORT} !=80
RewriteRule ^(.*)$ https://www.hardcode.ath.cx/$1 [L,R]
instead of

RewriteEngine On
RewriteCond %{SERVER_PORT} !=80
RewriteRule ^.* - [F]
RewriteRule ^(.*)$ https://www.hardcode.ath.cx/$1 [L,R]
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting a sub-domain (dummy question) Hellbound General 1 17th September 2005 03:23
Redirecting to another webserver derilium HOWTO-Related Questions 5 15th September 2005 16:00

All times are GMT +2. The time now is 06:43.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.