forward to another URL

N

Naved

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.
 
J

Joost Diepenmaat

Naved said:
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.
 
N

Naved

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.
 
J

Joost Diepenmaat

Naved said:
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...
 
B

Ben Morrow

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
 

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,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top