UsingPortForwardingWithJBoss

Using Port Forwarding with JBoss

 

The basic idea is to forward port 80 to port 8080.  Here is an example on Linux:

 

install rules:
  local_ip=1.2.3.4
  /sbin/iptables -t nat -A OUTPUT     --destination localhost   -p tcp --dport 80 -j REDIRECT --to-ports 8080
  /sbin/iptables -t nat -A OUTPUT     --destination ${local_ip} -p tcp --dport 80 -j REDIRECT --to-ports 8080
  /sbin/iptables -t nat -A PREROUTING --destination ${local_ip} -p tcp --dport 80 -j REDIRECT --to-ports 8080

  /sbin/iptables -t nat -A OUTPUT     --destination localhost   -p tcp --dport 443 -j REDIRECT --to-ports 8443
  /sbin/iptables -t nat -A OUTPUT     --destination ${local_ip} -p tcp --dport 443 -j REDIRECT --to-ports 8443
  /sbin/iptables -t nat -A PREROUTING --destination ${local_ip} -p tcp --dport 443 -j REDIRECT --to-ports 8443

flush:
  /sbin/iptables --flush PREROUTING -t nat
  /sbin/iptables --flush OUTPUT -t nat

list:
  /sbin/iptables --list PREROUTING -t nat
  /sbin/iptables --list OUTPUT -t nat

 

 

 

 

 

Using Port Forwarding with JBoss -- Alternative Method

 

I didn't have much with the above, I don;t believe that REDIRECT works well with sub-interfaces, i.e. eth0:x

 

I was able to use the following: to forward port 443 -> 8443

 

  /sbin/iptables -t nat -A PREROUTING -p tcp --dport 443 -d 192.168.x.x -j DNAT --to 192.168.x.x:8443