Federated CGI to CGI

B

beowoof

Hi all,

I have an interesting architecture that I'm trying to adapt a
configuration interface to.

At a high level, the architecture breaks down to:

Central Web Instance:
- let's call it www.web-central.bank.com
Regional Web Servers:
- www.web-usa.bank.com, www.web-eur.bank.com and
www.web-asia.bank.com

Now, ideally, users who want to configure each of the regional servers,
shouldn't have to actually log onto them locally. Instead, they would
log onto the central instance, select the region to modify and -- poof
-- the regional server is updated behind the scenes.

Next up, I have no intention of using anything like frames,
configuration databases, pull methods, etc. I want to be able to
"push" the configuration out to the regional servers from the central
instance ad hoc.

My first plan was to use xmlhttprequest to go off to a update.pl script
on the appropriate server and everything would be fine and dandy. Of
course, that didn't work. Calling a different web server causes
security warnings in IE and just won't work on Firefox.

So what I'd like are ideas on how to approach this, or where I'm going
wrong. I specifically only want to stay within the web framework -
ideally CGI -> CGI calls. I could of course have daemon processes
(this is all Linux/Apache btw), SSH push, etc... All of which I don't
want to do. I had this wonderfully "clean" idea of central web scripts
calling regional web scripts.

Thanks in advance.
 
B

beowoof

beowoof said:
I have an interesting architecture that I'm trying to adapt a
configuration interface to.
[ major snip ]

Do you have a Perl problem?

If not, you are in the wrong newsgroup.

Axel

Hiya,

I thought I made it pretty clear that I'm using Perl CGI as the
programming interface to achieve my desired outcome. In my example,
Perl is both the front end web page people go to and also the backend
CGI script engine to process the POST data and update the regional
server configurations.
 
B

beowoof

Hi!

Thanks for that. It is something that occurred to me as well. However
it is a bit "clunky" in that everything gets POST'd twice and the
user's browser session gets taken to the regional server in the end.

What I was hoping to achieve was have the user click "Submit" to a
change, then Javascript picks up the data, posts to the Perl script on
the configuraiton server using xmlhttprequest. The Perl script will
then *somehow* invoke the change on the regional servers.

Now, ideally I'd like the Perl script to call
http://www.region-web.bank.com/cgi-bin/update.pl directly. But I can't
think of a way this could be done programmatically... Can Perl pretend
to be a invoke URLs, capture the result and return it?
 
B

beowoof

Please bottom-post in this newsgroup. Here is a link to the posting
guidelines for this ng: http://www.augustmail.com/~tadmc/clpmisc.shtml

You can use the WWW::Mechanize module to allow a perl script to interact
with web pages as a browser would, or you can use WWw::Curl::easy to
post a form, or you can use LWP, or you can use create the POST request
using HTTP::Request and send it using Net::HTTP, or you can use the
"curl" external program to post the form, or you can use the "lynx"
external program to post, or you can use the "wget" external program, or ...

Very interesting... Not too sure about using external programs, but
you have given me some good ideas to work with.

Many thanks.
 
B

beowoof

beowoof said:
Very interesting... Not too sure about using external programs, but
you have given me some good ideas to work with.

Many thanks.

Ok, got it working. In case anyone else is curious, here is what I do:

On the central instance, the web page uses standard AJAX to call back
to the Perl CGI page as a POST.

This page, extracts the form information, works out which regional
server to update and POST's the configuration update information to
that regional server using HTTP::Request::Common qw(POST) and
LWP::UserAgent.

The regional server is another Perl CGI script that pulls out the
information and makes local changes. Back on the central instance, it
checks the HTTP return code and then returns some HTML to say if it was
successful or not.

Works without changing pages and all the hard work is invisible to the
user.
 
A

anno4000

beowoof said:
beowoof said:
I have an interesting architecture that I'm trying to adapt a
configuration interface to.
[ major snip ]

Do you have a Perl problem?

If not, you are in the wrong newsgroup.

Axel

Hiya,

I thought I made it pretty clear that I'm using Perl CGI as the
programming interface to achieve my desired outcome. In my example,
Perl is both the front end web page people go to and also the backend
CGI script engine to process the POST data and update the regional
server configurations.

You mean you are using Perl to generate the web pages. That doesn't
make it a Perl question. Look at the answers you got. They don't
discuss Perl but general web techniques.

Anno
 
J

J. Gleixner

beowoof said:
server to update and POST's the configuration update information to
that regional server using HTTP::Request::Common qw(POST) and
LWP::UserAgent.

The regional server is another Perl CGI script that pulls out the
information and makes local changes. [...]

Hopefully you are using some sort of authentication both to get to
the initial page and to the remote servers, otherwise anyone
who knows the URL, on the remote servers, could make the
"local changes".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top