0

Full disclosure: I’m new to home servers and Magento. Running Ubuntu Server 13.04 with LAMP and Magento Commerce 1.7.0.2 on a dedicated home server. I've already configured my server's static IP, router's firewall and port forwarding, and am running ddclient on my server to sync my router's dynamic IP with namecheap.com (my domain name and nameserver provider).

When I use a static index.html page, the page loads from my localhost using my server's static IP. The page also loads on the WAN using my router's IP and domain name (through either a proxy website or on my smartphone cell network). Using the proxy website helps avoid loopback timeouts. This narrows down the issue to Magento.

While using http://{localhostIP}/ as my base URL in Magento and loading Magento's index.php, I was able to access the file locally with my server's static IP. But, when accessing Magento over the WAN using my domain name or router's IP, it says "not available, HTTP Error 504: Gateway Timeout".

So then I tried adding my domain name as a base URL in Magento. Now I can access Magento over the WAN but not the LAN. Did anyone figure out a way to resolve this issue? Is this related to loopback?

The only two threads I could find on the issue haven't been resolved or updated recently: http://www.magentocommerce.com/boards/viewthread/273640/

http://www.magentocommerce.com/boards/viewthread/212885/

guttermonk
  • 223
  • 2
  • 11

1 Answers1

1

There's lots of little moving bits but I'll try my best to theorize about what might be going wrong here.

It sounds like your configuration is serving up pages via your WAN static IP address. And only your WAN static IP address.

Your home WAN connection, does it happen to be a cable modem? ISPs often will have local firewalls, usually operating on your cable modem itself. This is because in the early days of cable modems you could browse all your neighbors connections because your neighborhood is really one massive local network. People started hacking their neighbors and downloading their files (often shared by accident) so the cable companies responded by firewalling everyone in the neighborhood off from each other. So you aren't allowed to connect directly to a neighbor. This also has the unfortunate side effect of making you unable to connect to yourself (loop back). This configuration could work, if it weren't for that. You'd be bouncing packets off your cable company's router, back to your WAN service, and then out and back to your NAT'ed LAN.

Your router isn't likely to do anything smart like recognize the outgoing packet is actually its own externally facing IP address, and shortcut the packet back. Depending on what kind of router you have, you may be able to twist it into doing this.

So, what to do?

One thing you can do is have the web site served up under two IP addresses; your local IP address, and your remote IP address. When you are accessing your site within your LAN, then use the local address (something like "magneto.local") and when accessing it remotely, use the remote address. This is obviously kind of awkward. Another solution is to use DNS "views". If you control your own DNS server in your LAN, then it can serve one IP address internally and allow external services to operate as they normally would, resulting in different IP addresses depending on whether the requester is internal to your LAN or external from the WAN.

Much depends on your router and gateway configuration, and how much control you have over your local name service. I'm not familiar with Magneto, but Apache is certainly capable of service up one website via multiple IP addresses.

  • When loading index.HTML on the WAN using my router's IP and domain name through either a proxy website or on my smartphone cell network, the page loaded okay. Then when I switched to Magento's index.PHP, I got the 504 error. Using the IP of the proxy or smartphone prevented loopback with the html, but why did it stop working with the php file? – guttermonk Jun 19 '13 at 13:28
  • Also... Thank you for the alternative approaches. I'll have to look into those more. I am using a cable modem, and I've configured the modem and server firewall to allow port 80 and 443. The modem also has port forwarding on both of those ports to my server's static IP. – guttermonk Jun 19 '13 at 13:35