Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: 502 Bad Gateway Error with ModPerl scripts

by zby (Vicar)
on Sep 29, 2003 at 15:10 UTC ( #294981=note: print w/replies, xml ) Need Help??


in reply to 502 Bad Gateway Error with ModPerl scripts

How about not using the %{HTTP_HOST} variable but hardcoding the address? This of course would apply only if you have just one address but for a home PC I would expect that.

Replies are listed 'Best First'.
Re: Re: 502 Bad Gateway Error with ModPerl scripts
by thunders (Priest) on Sep 29, 2003 at 15:34 UTC
    That's my plan for external requests, but then it wouldn't work right for internal stuff. I'm not sure if I can tell apache to use a different rule for requests coming from 192.168.0.* I'm sure there's a way.

      If you're proxying requests, your Web server will be making the connection, so the hostname needs to be something your Web server can connect to. It could be as simple as hardcoding in 127.0.0.1.

      My suspicion is that when you're browsing internally, you're doing something like http://192.168.1.1, so when Apache rewrites the address to proxy, it connects to 192.168.1.1. When you're coming from the outside, you're visiting http://www.example.com. Apache rewrites the address, tries to connect to www.example.com, gets the IP address of the public side of the NAT, and can't connect to it. If that's the case, another solution is split horizon DNS, so that inside your network www.example.com resolves to 192.168.1.1, while outside it resolves to your external NAT address.

        Thanks for the tip. Changing the %{HTTP_HOST} part to the loopback address 127.0.0.1, seems to do the right thing in both cases.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://294981]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-10-15 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (82 votes). Check out past polls.

    Notices?