#1  
Old 16th May 2006, 04: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
Quote:
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:
Quote:
$IPT -t nat -A PREROUTING -p tcp -i eth0 -d 192.168.0.2 --dport 80 -j DNAT --to 192.168.1.3:443
$IPT -A FORWARD -i eth0 -o eth1 -p tcp -m state --state NEW -s $ARG0 --dport 443 -d 192.168.1.3 -j ACCEPT
On the www machine iptables :
Quote:
$ipt -t nat -A PREROUTING -i eth0 -p tcp -d 192.168.1.3 --dport 80 -j REDIRECT --to-port 443
Apache has mod_rewrite to handle the rewriting of the url but ...
Quote:
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 05:07.
Reply With Quote
Sponsored Links
  #2  
Old 16th May 2006, 16:26
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
 
Default

Have you tried

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

Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} !=80
RewriteRule ^.* - [F]
RewriteRule ^(.*)$ https://www.hardcode.ath.cx/$1 [L,R]
?
__________________
Falko
--
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
Reply

Bookmarks

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 02:23
Redirecting to another webserver derilium HOWTO-Related Questions 5 15th September 2005 15:00


All times are GMT +2. The time now is 21:30.


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