forward to another URL

Discussion in 'Perl Misc' started by Naved, Mar 26, 2008.

  1. Naved

    Naved Guest

    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.
    Naved, Mar 26, 2008
    #1
    1. Advertising

  2. Naved <> writes:

    > 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/
    Joost Diepenmaat, Mar 26, 2008
    #2
    1. Advertising

  3. Naved

    Naved Guest

    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.
    Naved, Mar 26, 2008
    #3
  4. Naved <> writes:

    > 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/
    Joost Diepenmaat, Mar 26, 2008
    #4
  5. Naved

    Ben Morrow Guest

    Quoth Joost Diepenmaat <>:
    > Naved <> writes:
    >
    > > 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
    Ben Morrow, Mar 26, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    687
  2. guenther schoebel
    Replies:
    2
    Views:
    6,474
    Eric Cartman
    Oct 10, 2003
  3. teej
    Replies:
    1
    Views:
    500
  4. qazmlp
    Replies:
    1
    Views:
    586
    Jonathan Turkanis
    Feb 15, 2004
  5. Just D.
    Replies:
    0
    Views:
    406
    Just D.
    Aug 11, 2004
Loading...

Share This Page