Virtual server aliases

For example, domain www.swcr.com is a virtual domain, hosted by ISP Xmission, so
pages http://www.xmission.com/~syswest/Home.html
and http://www.swcr.com/Home.html
are actually the same files. Is it possible to know somehow, that two URS lead us to the same point ?
By the way, if we open connection to www.swcr.com
...
struct hostent *hp;
...
hp = gethostbyname(...)
and try to search in
hp->h_aliases, it does not work..
Thanks in advance...
LVL 1
trofAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

julio011597Commented:
With CGI? could you tell how a similar information relates to CGI programs?

...just wandering if there's some different way to reach your final goal.
0
trofAuthor Commented:
My CGI has to pull pages to process them and I don't want to process the same page twice..
0
julio011597Commented:
I see... why not just translate each domain name into the corrensponding IP address, and keep track of the IP addresses already processed? Furthermore, you could also associate ports to IPs, in case there are different web servers on different ports on the same machine.

BTW, your code cannot work because you have no access to someone else's alias configuration.

What kind of help could i give?

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

eckspurtCommented:
You can ensure that pages only get served once by setting up the configuration for one of those virtual servers to issue a redirect pointing at the other one.  If someone tries to go to http://www.xmission.com/~syswest/Home.html, they'd wind up actually loading http://www.swcr.com/Home.html.  That's the best approach you can take, since a URL is itself a unique identifier.  Virtual hosting gives the different server names different IP addresses, making it so that to all outside appearances, they're truly two different sites.

0
trofAuthor Commented:
I can not setup any configuration. I'm asking about not my virtual server, but about two abstract URL, pointed onto the same page... Is it really impossible to detect so ?
0
eckspurtCommented:
Okay, so you need to come up with something out of the ordinary.  Exactly which kind of access do you want to affect?  Are you trying to make it so that any browser which accesses first one page and then the other will fetch the first one from cache?
0
julio011597Commented:
Ok, i won't submit this as an answer because you are offering 250 points and i've no time to support you as needed; but, the answer remains the same: resolve IP addresses and work with them, there's no other way (and, BTW, what's so hard with this one?)
0
trofAuthor Commented:
Ok,
julio says, I should just work on IP address level, and
eckspurt says, virtual servers have different IP addreses, and it does not work... So, tell me again, what should I do ?
PS: and please, _answer_, don't add comments, I don't want to keep these 250 points.. :-)
0
julio011597Commented:
No, no.

I'm not telling you to work at  IP layer level; what you have to do is "resolve host domain names to their corrensponding IP addresses" (the well known dotted format: xxx.xxx.xxx.xxx).

Virtual server aliases DO share the same IP; actually, creating virtual servers is a way to give more than one name to a single IP address.

I strongly suggest you delete this question and repost it to the Unix/Networks topic area.
You won't get any good advice from strictly CGI experts.
0
eckspurtCommented:
You also won't find strictly CGI experts responding.  I'm a Unix sysadmin.

I'd hoped not to complicate the issue with DNS-only virtual servers, since it seems like the goal requires an IP-specific solution.  Yes, you *can* have "virtual" servers which respond to different domain names on the same IP address, but browsers are not required to specify the domain name of the page they're requesting, so that type of virtual server isn't useful as a public site.

www.swcr.com is at 204.228.141.42
www.xmission.com is at 198.60.22.9 and 198.60.22.4 (presumably rotated for better reliability)

Your CGI script can look in the environment passed to it by the server to determine which way the user connected to it.  See the  SERVER_NAME environment variable.

A description of the CGI spec that relates to this is at http://hoohoo.ncsa.uiuc.edu/cgi/env.html

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
julio011597Commented:
eckspurt: i guess you still don't get the point.

The CGI in question is ITSELF trying to establish a connection to other web servers (through sockets); trof is looking for a way to handle virtual servers in order to have its CGI not request outside pages more than once.

I'll give you a real-life example:

say i want to put a search engine on my site, but, someway, have not enough energy to set it up; i could just write a CGI which, itself, connects to Altavista, sends the given query, reads back results, reformats them depending on my own layout, sends back stolen information to the user.
0
julio011597Commented:
BTW, i am not a strict CGI expert, as well; i develop search engines on Digital AlphaServers, and make a living on it.
0
trofAuthor Commented:
SERVER_NAME is good enough.
0
julio011597Commented:
SERVER_NAME not always works... but, good luck!

I spent 25 points to see *how* could you give away such a grade, and, points apart, make me waste time and energy.

EE is but a big knowledge-base container, and people like you help a lot making it unuseful.

But, nothing more than my humble opinion: i just couldn't resist.
0
eckspurtCommented:
SERVER_NAME should always either contain the hostname or IP address of the server.  Otherwise it's a broken CGI implementation.

I'm glad that was the answer you're looking for, and happy you gave the answer a good grade, but you'd have gotten a quicker answer if you let on right away that you needed a pointer to the CGI documentation!

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.