Google Answers Logo
View Question
 
Q: Hosting a web service / site from within a local network ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Hosting a web service / site from within a local network
Category: Computers > Operating Systems
Asked by: cadgey-ga
List Price: $14.00
Posted: 09 Sep 2005 07:09 PDT
Expires: 09 Oct 2005 07:09 PDT
Question ID: 566061
I want to host an online photo album with the ability for users to
upload photos that will be resized & displayed.  I found a suitable
product that works well (emAlbum) which I am running on my web host. 
(see http://www.leodiensian.co.uk/cgi-bin/junior/emAlbum.cgi?cmd=show_sub&path=U-10).

The advanced product, however needs some image manipulation software
loading on the server, which is not supported on the package I have. 
I therefore decided to host the app on a PC at home.  (I have a small
network with a few PCs and an ADSL Modem/router that does NAT).  This
is an XP Pro box running IIS.

Everything was set up ok, but then I realised a problem - the domain
(www.cadgey.co.uk) was pointed at my router, and NAT was passing
requests to the right PC, but any references to www.cadgey.co.uk from
within the PC, or within the network failed as the router could not
handle it - as the requested IP was itself I guess.  I solved this by
pointing the HOSTS file back at the internal IP address of the server,
and now it all seems to work perfectly from within my network.

Unfortunately, from outside of my network, none of the images are
displayed - the structure shows, but every image shows as a red cross.
 If I display properties for the image it shows the correct address,
and if I put that address in a browser the image is displayed - within
the page being served though it fails.

I think it must be something to do with the way that the IIS server is
passing the address - that it isn't picking up the HOSTS file, or
something like this.

This is making me pull my hair out, as it all looks good from inside,
but not from outside.  I am only passing port 80 to the server if this
has any relevance.  The address is www.cadgey.co.uk to look at the
album.

Any ideas?

Request for Question Clarification by maniac-ga on 09 Sep 2005 15:21 PDT
Hello Cadgey,

Could you indicate the brand and model of the modem / router?

If so, I could provide specific instructions (if the model supports
it) to enable access to your local PC for the hosted application or
suggest another brand / model that would provide the capability.

  --Maniac

Request for Question Clarification by maniac-ga on 09 Sep 2005 15:35 PDT
Hello Cadgey,

After some testing it appears your NAT is set up correctly - please
ignore the previous request.

Let me confirm your set up...

  Internet - ADSL modem / router - local PC

The router is set up so that remote references to
  www.cadgey.co.uk  (port 80)
goes to your local PC [running IIS] where the "pro" version of emAlbum
is installed.

Based on the image paths, it appears there are spaces in the path. For example:
  http://cadgey.co.uk/emAlbum/albums/Cadgey's%20Personal%20Photos/2005-08-05%20Croatia%20Summer%20Holiday/_fullsize/IMGP0738.JPG
[which does load in my browser from the outside]

This MAY cause a problem with the configuration file, specifying the
image path and/or URL with those spaces. I can't seem to find a note
in the documentation about how to handle spaces in directories or file
names.

As a test, try renaming the directories (and adjusting the config
file) to see if this is true.

  --Maniac

Clarification of Question by cadgey-ga on 09 Sep 2005 16:06 PDT
Hi 

Thanks for the effort so far. 

1) My router is a buffalo WMR-G54, which handles the NAT/Virtual
server setup ok, but unfortunately is unable to allocate a separate IP
address to an individual DMZ server.

2) I don't think the spaces can be an issue, as none of the icons on
the front page show - ignoring the actual albums for now.  i.e.
http://www.cadgey.co.uk/emAlbum/images/pro/icon_album.gif does not
show on the main page, but will show if the URL is entered separately.

I still feel it is something to do with the routing - IIS isn't
looking up the HOSTS file to realise it should be pointing back at
itself somehow?

Cheers
Cadgey

Request for Question Clarification by maniac-ga on 10 Sep 2005 15:43 PDT
Hello Cadgey,

Hmm. I am not so sure it is a routing problem - when I look at the
generated source, the source appears to have the correct addresses for
the images and when I access the images using those paths it works
just fine.

After noticing some differences between the source (of your original
page and the new one) I ran the HTML validator at
  http://validator.w3c.org/
but it noted far more errors on the old page than the new one. That
looks like a dead end.

There may be a configuration problem with IIS on your system or some
error messages from the server that you should be reviewing. The way
to enable error message recording varies by IIS version - if it is not
already enabled and if you can't find the reference to this locally,
try a search with
  IIS enable error log (plus your IIS version number)
and follow the steps (for IIS 6.0, I noticed you also needed to
reboot) and review the log files.

  --Maniac

Clarification of Question by cadgey-ga on 11 Sep 2005 00:51 PDT
Hi

You could be right - I left most of the IIS settings as default, but
what gets me is that it works from within the network (with a HOSTS
file set up on the other PC's).

I just feel I am missing something obvious - either in the IIS
configuration, or in port forwarding etc.

This is the IIS log for a recent session:

#Fields: time c-ip cs-method cs-uri-stem sc-status 
08:08:23 81.168.155.240 GET / 401
08:09:42 81.168.155.240 GET / 401
08:13:29 81.168.252.179 GET / 401
08:17:48 81.168.131.248 GET / 401
08:27:56 81.168.148.68 GET / 401
08:37:26 81.168.131.248 GET / 401
08:42:00 81.168.131.248 GET / 401
08:46:03 81.168.252.179 GET / 401
08:56:33 81.168.148.68 GET / 401
08:57:15 81.168.226.6 GET / 401
08:59:02 81.168.226.6 GET / 401
09:03:40 81.168.226.6 GET / 401
09:06:14 81.168.155.240 GET / 401
09:09:14 81.168.226.6 GET / 401
09:09:49 81.168.131.103 GET / 401
09:11:23 81.168.148.68 GET / 401
09:35:26 82.69.111.138 GET /cgi-bin/pro/emAlbum.cgi 200
09:35:41 82.69.111.138 GET /cgi-bin/pro/emAlbum.cgi 200
09:35:51 82.69.111.138 GET /cgi-bin/pro/emAlbum.cgi 200
09:36:01 82.69.111.138 GET /cgi-bin/pro/emAlbum.cgi 200
09:43:21 81.168.238.192 GET / 401
09:50:40 81.168.238.192 GET / 401
10:13:17 81.168.253.145 GET / 401
10:15:31 81.168.238.192 GET / 401
10:21:47 81.168.148.68 GET / 401
10:23:57 81.168.253.145 GET / 401
10:25:17 81.168.253.145 GET / 401
10:28:18 81.168.173.148 GET / 401
10:28:47 81.168.199.219 GET / 401
10:31:40 81.168.253.153 GET / 401
10:35:07 81.168.148.68 GET / 401
10:36:03 81.168.211.182 GET / 401
10:41:26 81.168.148.68 GET / 401
10:55:05 81.168.148.68 GET / 401

Cheers
Cadgey

Request for Question Clarification by maniac-ga on 11 Sep 2005 07:26 PDT
Hello Cadgey,

Very odd - I ran "Ethereal" (a very good network protocol analyzer)
when I fetched your album and captured "conversations" like this
one...
[notice my system is trying to fetch one of the images but I get text instead]

GET /emAlbum/images/pro/emAlbum.gif HTTP/1.1
Host: www.cadgey.co.uk
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
rv:1.4) Gecko/20030624 Netscape/7.1
Accept: video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://81.168.70.185/cgi-bin/pro/emAlbum.cgi

HTTP/1.1 200 OK
Date: Sun, 11 Sep 2005 14:01:38 GMT
Server: Apache/1.3.33 (Unix)
Keep-Alive: timeout=2, max=200
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

1d3
<HTML><HEAD>
<META NAME="description" content="">
<META NAME="keywords" content="">
<TITLE>Cadgey's Webspace</TITLE>

</HEAD>
<FRAMESET ROWS="100%,*" BORDER="0" FRAMEBORDER="0">
<FRAME SRC="http://81.168.70.185/emAlbum/images/pro/emAlbum.gif"
SCROLLING="AUTO" NAME="bannerframe" NORESIZE>
</FRAMESET>
<NOFRAMES>
Cadgey's Webspace
<P>
<DIV ALIGN="CENTER"><A
HREF="http://81.168.70.185/emAlbum/images/pro/emAlbum.gif">http://cadgey.co.uk/</A></DIV>
</NOFRAMES>
</HTML>

0

When I load that file (emAlbum.gif), I get the same content as above
plus the following

GET /emAlbum/images/pro/emAlbum.gif HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Referer: http://www.cadgey.co.uk/emAlbum/images/pro/emAlbum.gif
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us)
AppleWebKit/412.6.2 (KHTML, like Gecko) Safari/412.2.2
Connection: keep-alive
Host: 81.168.70.185

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sun, 11 Sep 2005 14:17:37 GMT
Content-Type: image/gif
Accept-Ranges: bytes
Last-Modified: Thu, 14 Jul 2005 19:07:50 GMT
ETag: "07fe53a788c51:8e5"
Content-Length: 1511

GIF89a  [remainder of binary removed]

[which displays the image] Then I looked at "view source" and "view
info" in the browser and sure enough, the "gif image" is really a web
page that displays the gif image from the other location.

So there is definitely a configuration problem. Note in the first
case, I am fetching from
  "www.cadgey.co.uk"
and in the second case from the IP address
  "81.168.70.185"

[guessing at this point] I believe you need to change the emAlbum
configuration so it fetches the images from the IP address and not the
host name.

  --Maniac

Clarification of Question by cadgey-ga on 12 Sep 2005 17:33 PDT
Hi Maniac

Switching the address from the domain to the ip has worked - it now
appears to work fine from outside the network (although I can't use at
all from inside the network!!)

It is still very frustrating though, as I don't understand why it
doesn't work with the correct setup - it appears to switch
www.cadgey.co.uk for the correct ip address - so one would think they
were the same thing.

Thanks for all your efforts - if you or anyone else can shed further
light on this I would appreciate it, but if you want to change your
clarification to an answer I will accept it & thanks once again.

Cheers
Cadgey
Answer  
Subject: Re: Hosting a web service / site from within a local network
Answered By: maniac-ga on 13 Sep 2005 17:59 PDT
Rated:5 out of 5 stars
 
Hello Cadgey,

Glad to help. Let me recap from the start and explain the steps
followed to diagnose the problem you had and some possible further
steps.

Some of the causes considered and rejected:
 - possible misconfigured NAT router - from the outside, verified that
the images and pages could be accessed (though still not quite working
correctly)
 - noted spaces in paths - scripts (especially those written on older
Unix systems / rehosted to Windows) will sometimes have problems with
spaces in directory or file names. You confirmed that paths without
spaces did not work either, so not the specific cause.
 - broken HTML - still could be a minor problem but the "page that
worked" had more problems with the validator than the page that did
not work. If the pages are generated by emAlbum Pro, I would still
report the validation errors to the vendor and get them to fix their
product.
 - IIS configuration problem / missing errors - the IIS log did not
show anything erroneous so we ruled that out.
 - emAlbum configuration problem - this appears to be the "root cause"
where the web server at "www.cadgey.co.uk" was providing text (HTML)
files instead of the images. The reason they "looked right" when
displayed in a browser (by themselves) was that the file was served as
text/html and could be rendered properly as a top level page (but not
OK as an image within another page). I detected this most clearly by
analyzing the data stream between your web servers and my machine
using Ethereal
  http://www.ethereal.com/
which is a VERY powerful network analyzer. More specifically I did the
following steps (also described in the Ethereal documentation)
 o Started both the browser & Ethereal (note - depending on your
system, you may need to be an "Administrator" to run it)
 o Stopped other network operations to reduce the "noise"; I still had
some data captured that I did not want but this helps
 o Started a capture - menu Capture -> Interfaces -> Start or Capture
-> Start (if the default is already set up to be your primary network
interface). Note if you start another capture without saving the old
data, Ethereal will ask to to confirm to throw out the old capture
data.
 o In the browser, loaded the page (used the "reload" button if
necessary to fetch all files).
 o Stopped the capture (stop button). At this point Ethereal should
display all the messages captured. If you did a previous capture and
looked at a portion (e.g., a "conversation"), you may have to clear
the filter to see all the messages.
 o Selected a message I could recognize, for example, one I see now is
  (sequence/time/source/destination) protocol=HTTP, Info = GET
/emAlbum/images/pro/emAlbum.gif
 o Used the menu Analyze -> Follow TCP Stream which brings up a window
showing the sequence of messages. At this point I could easily see the
problem (text instead of image) and report it to you.

At this point, you made the configuration change I suggested and the
web site is "almost" working - it works from the outside and not from
the inside. You may be able to "fix" that problem if you use a "static
route" for the address 81.168.70.185. Your "inside" machines are
probably sending a message with that address to the router / it does
not send it to your inside machine running IIS but tries to send it to
the network  (or tries to interpret the message itself) - either way
it fails. You should be able to set up a static route using the
administrative interface of your local router - just direct the IP
81.168.70.185 to your local IIS server machine and it should be OK.

The other item that still puzzles me a little is the relationship of
the two servers:
  www.cadgey.co.uk - running Apache (I assume your remote server)
  81.168.70.185 - running IIS 5.1 (I assume your local server)
The fix for local systems you originally describe now makes sense -
all the requests are handled on the local system and none on the
remote server. For the people on the outside, they get the page from
the remote server and the images from your local server. If that is
the way it is supposed to be - you are set up right now. If that is
not what you wanted to happen, please make a clarification request and
I should be able to make some further suggestions.

Good luck and Cheers.

  --Maniac

Request for Answer Clarification by cadgey-ga on 14 Sep 2005 01:17 PDT
Hi

Thanks Maniac - I will try & set up the static route and see if that is supported.

It's not possible to use the HOSTS file to replace one ip address with
another in the way that you can with a domain, I assume?

www.cadgey.co.uk is just redirecting to my home server (held with
www.1and1.co.uk) - all the pages & images should be being served from
my home PC.  I think that they are doing a frameset redirect - i.e.
hosting all of my site within a frame, and that is why it appears that
the page is on their server.

Cheers
Cadgey

Clarification of Answer by maniac-ga on 14 Sep 2005 17:22 PDT
Hello Cadgey,

Alas no, the host file converts a name to an IP address, not
translating between IP addresses.

Good luck with your work.

  --Maniac

Request for Answer Clarification by cadgey-ga on 19 Sep 2005 09:44 PDT
I worked it out in the end - the host was doing some form of frameset
forwarding (my local server was appearing within their page) and that
was messing it up.

I changed the DNS for my domain to point straight at my ip, and it all
started working!

Cheers
Cadgey

Clarification of Answer by maniac-ga on 20 Sep 2005 06:13 PDT
Hello Cadgey,

Glad to hear that the last problem was resolved.

  --Maniac
cadgey-ga rated this answer:5 out of 5 stars
Nice work on this - much appreciated.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy