7 thoughts on - Redirecting Web Requests From Localhost

  • Could be hardcoded in your java app, by hostname or ip?

    Just open your java (its a zip renamed) and see file contents (some of files inside, are text plain).

    Also, you can find a debuger

    Diego Sanchez

    Sent from my mobile

    —–Original Message—

  • IF (IF) is trying to get data by hostname, dnsmasq maybe could help. IF (IF) is by ip addres, problem still here.

    First he need understand how is working the app or wait to developer.

    I prefer lost 2 minutes with grep, that a lot of minutes with dnsmasq AND 2 minutes with grep later..

    Diego Sanchez

    Sent from my mobile

    —–Original Message—

  • I think you has to do POSTROUTING
    anyway, check the port, it is wrong at least in your post – 80 vs. 443

    or

    dummy interface, in ifcfg-dummy, something similar to this:

    DEVICE=dummy BOOTPROTO=none ONBOOT=yes TYPE=Ethernet NETMASK=255.255.255.255
    IPADDR=XXX.XXX.XXX.XXX

  • hmm, locally generated messages do not pass the PREROUTING AFAIK
    this was why I was suggesting POSTROUTING, but… POSTROUTING is wrong too according to the manpage for iptables

    DNAT:
    This target is only valid in the nat table, in the PREROUTING and OUTPUT chains, and user-defined chains which are only called from those chains.

    If I read it correct, this rule should go into the OUTPUT chain.

  • You have the prerouting but you have to forward it as well. This allows a connection on the Internet to make a connection to a internal machine on my local network. Router machine’s local network ip 10.0.0.1 on eth1.
    10.0.0.5 internal machine. iptables -A FORWARD -p tcp -i ppp0 -o eth1 -d 10.0.0.5 –dport 1234 -j ACCEPT
    iptables -t nat -A PREROUTING -p tcp -i ppp0 –dport 1234 -j DNAT
    –to-destination 10.0.0.5:1234

    ip and ports changed to protect the guilty :)

    Gary.

LEAVE A COMMENT