Re: Redirecting internally
Re: Redirecting internally
- Subject: Re: Redirecting internally
- From: Eric Stewart <email@hidden>
- Date: Fri, 22 Jul 2005 00:23:49 -0400
Well, I finally figured it out.
You have to pull ALL the directives out of apache.conf and put them in
the main httpd.conf. Like Chuck said, the LoadModule WebObjects_module
must go above LoadModule_Rewrite. You also need to a directive that
doesn't exist in any of the config files. AddModule mod_WebObjects.c
must go above mod_rewrite.c.
Then you put the remaining directives from the apache.conf file at the
bottom of the httpd.conf file but above the virtual host includes.
If you are using /cgi-bin/WebObjects as your WebObjectsDocumentRoot,
then you need to disable the ScriptAlias /cgi-bin/ in the httpd.conf.
Then all you need to do is put the RewriteRules in the config file of
the virtual host and you are cooking with gas.
I really appreciate everyone's help in giving me ideas of where to
find the problems.
On 7/21/05, Eric Stewart <email@hidden> wrote:
> I actually got the redirect to operate with RedirectMatch, but it's an
> external redirect and all the scripts that are accessing the
> application fail on an external redirect. So I have to do an internal
> redirect with is completely transparent to the client.
>
> I appreciate you help though.
>
> On 7/21/05, Galen Rhodes <email@hidden> wrote:
> > If you're working with Apache you could also use Apache's
> > RedirectMatch statement.
> >
> > http://httpd.apache.org/docs/mod/mod_alias.html#redirectmatch
> >
> > To have Apache redirect a URL like "/users/grhodes" to a DA request
> > like "/cgi-bin/WebObjects/SomeApp.woa/wa/viewUser?user=grhodes" you
> > would add this to Apache's config file.
> >
> > RedirectMatch ^/users/(.+)$ /cgi-bin/WebObjects/SomeApp.woa/wa/
> > viewUser?user=$1
> >
> > In YOUR case it would look something like this:
> >
> > RedirectMatch ^/cgi-bin/script.cgi?(.+)$ /cgi-bin/WebObjects/
> > Script.woa/wa/action?$1
> >
> >
> >
> > On Jul 21, 2005, at 10:02 PM, Zak Burke wrote:
> >
> > > Eric Stewart wrote on 7/21/05 5:19 PM:
> > >
> > >> I'm currently converting a script originally in cgi to WO. The server
> > >> gets requests something similar to this
> > >> http://www.example.com/cgi-bin/script.cgi?a=1&b=2.
> > >>
> > >> I need that to be internally redirected to
> > >> http://www.example.com/cgi-bin/WebObjects/Script.woa/wa/action?
> > >> a=1&b=2
> > >>
> > >
> > > bounce the browser from the CGI to the WO page:
> > >
> > > #!/usr/local/bin/perl
> > > print "Location: http://...wa/action?$ENV{'QUERY_STRING'}\n\n";
> > >
> > >
> > > or grab content from the new page, but display it as though
> > > http://www.example.com/cgi-bin/script.cgi?a=1&b=2 itself generated the
> > > content:
> > >
> > > #!/usr/local/bin/perl
> > >
> > > use strict;
> > > use LWP;
> > >
> > > main();
> > >
> > > sub main
> > > {
> > >
> > > print "Content-type: text/html\n\n";
> > >
> > > my $ua = LWP::UserAgent->new();
> > > my $url = "http://.../Script.woa/wa/action?$ENV{'QUERY_STRING'}";
> > > my $res = $ua->get($url);
> > > if ( $res->is_success ) {
> > >
> > > print $res->content;
> > >
> > > } else {
> > >
> > > print "ERROR retrieving $url: " . $res->status_line();
> > >
> > > }
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Do not post admin requests to the list. They will be ignored.
> > > Webobjects-dev mailing list (email@hidden)
> > > Help/Unsubscribe/Update your Subscription:
> > > 40thissmallworld.com
> > >
> > > This email sent to email@hidden
> > >
> >
> >
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden