Click here to get back home

forward to another URL

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
forward to another URL Naved 03-26-2008
Posted by Naved on March 26, 2008, 2:38 am
Please log in for more thread options
Hello,

Can anyone tell me how can I forward to another URL from my page in
CGI PERL.
I don't want to use Redirect method as it is sending back to client
side and then redirecting the page.

Application::Forward is there but I don't get any example related to
that method.
It is not working properly, may be because I haven't implemented it
correctly.

any help will be appreciable.

Thanks in advance.

Posted by Joost Diepenmaat on March 26, 2008, 3:35 am
Please log in for more thread options

> Hello,
>
> Can anyone tell me how can I forward to another URL from my page in
> CGI PERL.
> I don't want to use Redirect method as it is sending back to client
> side and then redirecting the page.

IIRC there isn't a really standardized way to do that, but apache/cgi
will do an internal redirect if the target URL is a *root-relative* path,
so something like:

print $q->redirect('/some/path.html');

will probably work.

> Application::Forward is there but I don't get any example related to
> that method.

I've never heard of that module/function/whatever.


--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

Posted by Naved on March 26, 2008, 4:03 am
Please log in for more thread options
Thanks for the help.

but unfortunately it is not working.
The page is forwarding to another URL after URL re-writing.
which in turn does not solve my issue.

I don't want user to bookmark my page and go directly to html page
instead of first executing login.pl script.

Posted by Joost Diepenmaat on March 26, 2008, 6:22 am
Please log in for more thread options

> Thanks for the help.
>
> but unfortunately it is not working.
> The page is forwarding to another URL after URL re-writing.
> which in turn does not solve my issue.
>
> I don't want user to bookmark my page and go directly to html page
> instead of first executing login.pl script.

Then you *do* want to redirect at the client side, or maybe I'm not
getting what your problem actually is...

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

Posted by Ben Morrow on March 26, 2008, 10:16 am
Please log in for more thread options

>
> > Thanks for the help.
> >
> > but unfortunately it is not working.
> > The page is forwarding to another URL after URL re-writing.
> > which in turn does not solve my issue.
> >
> > I don't want user to bookmark my page and go directly to html page
> > instead of first executing login.pl script.

Why are you issuing a redirect at all? Just read in the HTML file
yourself, and serve it up as the output of your script with a text/html
Content-type.

> Then you *do* want to redirect at the client side, or maybe I'm not
> getting what your problem actually is...

If the user visits http://example.com/cgi.cgi, and that issues a 30x to
http://example.com/html.html, the address in the address bar will
change. If the user then bookmarks the page, the bookmark will be to
/html.html, bypassing the CGI. The only safe way around this is to
remove html.html from the document tree and have cgi.cgi return the HTML
directly: there is nothing to prevent a malicious user from visiting
/html.html directly if it is accessible. Depending on what you are
trying to do, HTTP auth may be a better solution.

Ben


Similar ThreadsPosted
how to forward an array to another cgi? February 6, 2007, 11:40 pm
Forward variables to cgi script May 29, 2006, 11:01 pm
Perl and sendmail alias/forward file March 6, 2006, 5:31 pm
Scan forward n lines from specified file offset November 5, 2006, 2:33 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap