Mailing List Archive

always being redirected to localhost
Hi everybody,

I just recently ran across the Debian mediawiki install guide
(http://meta.wikimedia.org/wiki/Running_MediaWiki_on_Debian_GNU/Linux)
which I followed and installed everything as described. Or so I
thought... Since I was testing everything using the same machine where
I had installed it (locahost) there were no problems. But when I try
to access the page from outside I get lots of errors, because I'm
constantly being redirected to localhost... and I have no idea why.

A better description of what is happening is here:
http://meta.wikimedia.org/wiki/Talk:Running_MediaWiki_on_Debian_GNU/Linux#localhost_problem...

Could you please help? A wiki that people can't get into is of no use :(
I really would like to have this fixed.... by the way, this is
probably one of the best projects I've seen, great job to all
developers!!

Thanks a lot,

Roberto.
Re: always being redirected to localhost [ In reply to ]
On Nov 5, 2004, at 6:32 AM, Roberto Winter wrote:
> But when I try
> to access the page from outside I get lots of errors, because I'm
> constantly being redirected to localhost... and I have no idea why.

Apache thinks its canonical hostname is "localhost". It is mistaken in
this impression, so set the ServerName directive in httpd.conf to the
correct hostname to disabuse it of this notion.

If for some reason this fails to produce the correct autodetected value
in MediaWiki, override $wgServer with 'http://my.host.name';

-- brion vibber (brion @ pobox.com)
Re: always being redirected to localhost [ In reply to ]
You were right! The problem was with http.conf.
But changing it is not really an optimal solution to me.

The thing is: I'm using a server that is inside a network, so that the
box connected to the internet uses iptables to redirect a port to the
internal server's http port. The thing is, from inside the network,
this redirection does not work. Which means that now all other people
can see my wiki, except for me!! That is because the ServerName is
something that must be resolved (=not localhost), and that (when
resolved) points to the main server on the local network.

Is there something I can do about this? I'm no expert, maybe it is
possible to change something on http.conf, or iptables or even
mediawiki...

Thanks, anyway.
Roberto.


On Fri, 5 Nov 2004 10:33:35 -0800, Brion Vibber <brion@pobox.com> wrote:
> On Nov 5, 2004, at 6:32 AM, Roberto Winter wrote:
> > But when I try
> > to access the page from outside I get lots of errors, because I'm
> > constantly being redirected to localhost... and I have no idea why.
>
> Apache thinks its canonical hostname is "localhost". It is mistaken in
> this impression, so set the ServerName directive in httpd.conf to the
> correct hostname to disabuse it of this notion.
>
> If for some reason this fails to produce the correct autodetected value
> in MediaWiki, override $wgServer with 'http://my.host.name';
>
> -- brion vibber (brion @ pobox.com)
>
>
>
Re: always being redirected to localhost [ In reply to ]
On Nov 6, 2004, at 3:27 PM, Roberto Winter wrote:
> The thing is: I'm using a server that is inside a network, so that the
> box connected to the internet uses iptables to redirect a port to the
> internal server's http port. The thing is, from inside the network,
> this redirection does not work.

Consider adding another iptables rule so that it works inside, as
well...

-- brion vibber (brion @ pobox.com)
Re: always being redirected to localhost [ In reply to ]
well, the thing is, I don't even know why it won't work... so I don't
know what rule I should add... the rule I have now is something like:

iptables -t nat -A PREROUTING -i eth0 -p tcp -d $IP --dport 8080 -j
DNAT --to 192.168.1.10:80
iptables -A FORWARD -i eth1 -o eth1 -p tcp -d 192.168.1.10 --dport 80 -j ACCEPT

where $IP is the ip of the box connected to the internet, and
192.168.1.10 is where the wiki is located.
does anyone know what I should do?
is this getting too off topic?

thanks again.
Roberto.

On Sat, 6 Nov 2004 15:48:34 -0800, Brion Vibber <brion@pobox.com> wrote:
> On Nov 6, 2004, at 3:27 PM, Roberto Winter wrote:
> > The thing is: I'm using a server that is inside a network, so that the
> > box connected to the internet uses iptables to redirect a port to the
> > internal server's http port. The thing is, from inside the network,
> > this redirection does not work.
>
> Consider adding another iptables rule so that it works inside, as
> well...
>
>
>
> -- brion vibber (brion @ pobox.com)
>
>
>
Re: always being redirected to localhost [ In reply to ]
| well, the thing is, I don't even know why it won't work... so I don't
| know what rule I should add... the rule I have now is something like:
|
| iptables -t nat -A PREROUTING -i eth0 -p tcp -d $IP --dport 8080 -j
| DNAT --to 192.168.1.10:80
|
| iptables -A FORWARD -i eth1 -o eth1 -p tcp -d 192.168.1.10 --dport 80
| -j ACCEPT
|
| where $IP is the ip of the box connected to the internet, and
| 192.168.1.10 is where the wiki is located.

I'm not sure if I understand everything you're trying to do, but:

- Why don't the internal machines simply go straight to 192.168.1.10?

- If you don't want that, and you want to redirect the internal
traffic, the above rules look wrong. The first rule applies to
packets arriving at your gateway machine on eth0. The second
applies to packets arriving AND leaving on eth1. So on the face of
it, these two rules have nothing to do with each other.

If you want to send me mail offline, I may be able to help further.
Please send more info (I only just re-joined this list, so I missed
your original posting), including which interface is the internal and
which is the external.

Terry
Re: always being redirected to localhost [ In reply to ]
On Monday 08 November 2004 12:47 pm, Terry Jones graced us with these words:
> - Why don't the internal machines simply go straight to 192.168.1.10?
>

I just resolved the same problem on my network, but I'm not sure what the
repercussions will be yet. Internal machines *were* just going straight to
the server on the LAN, but using their LAN host names and/or IP, which
confused the scripts, which were looking for the hostname the webserver
reports to the external world. I only need to connect to the server from the
same machine that hosts it, not others on the LAN, so I just aliased the
external gateway hostname to the internal IP in /etc/hosts. Now mediawiki
(and movable type, which had the same problem) works equally well from that
machine or outside. Don't know if this breaks anything else. My ability to
ping the external interface and check DNS status is gone for that machine, I
suppose.

--
John M. Norvell
Re: always being redirected to localhost [ In reply to ]
Hi again,
John's suggestion did work out. Just added the right lines to 'hosts'.
That is fine, since it was only an "inside" network problem. Thanks a
lot,
Roberto.


On Mon, 8 Nov 2004 13:14:42 -0500, John Michael Norvell
<norvell@fas.harvard.edu> wrote:
> On Monday 08 November 2004 12:47 pm, Terry Jones graced us with these words:
> > - Why don't the internal machines simply go straight to 192.168.1.10?
> >
>
> I just resolved the same problem on my network, but I'm not sure what the
> repercussions will be yet. Internal machines *were* just going straight to
> the server on the LAN, but using their LAN host names and/or IP, which
> confused the scripts, which were looking for the hostname the webserver
> reports to the external world. I only need to connect to the server from the
> same machine that hosts it, not others on the LAN, so I just aliased the
> external gateway hostname to the internal IP in /etc/hosts. Now mediawiki
> (and movable type, which had the same problem) works equally well from that
> machine or outside. Don't know if this breaks anything else. My ability to
> ping the external interface and check DNS status is gone for that machine, I
> suppose.
>
> --
> John M. Norvell
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l@Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>