FAQ
Let's say I want to send people back and forth between an HTTP
connection and an HTTPS connection on a server based on some action. For
example, clicking on a "logout" button from within my application while
connected via HTTPS does something like:

$c->res->redirect("http://foo.com/");

The above seems like a fine solution except it totally disregards the
beauty of uri_for, which I would love to be using for stuff like this.
Without uri_for, problems arise when you do things like test via the
built in Perl webserver (the one running on port 3000 by default) while
on the same webserver as my "production" application.

So the real question is, how do I properly refer to my webserver and/or
application root and include port or SSL flags? I guess I'm looking for
something like $0 within uri_for.

-d

Search Discussions

  • Ashley Pond V at Mar 26, 2008 at 8:26 pm
    There are two approaches which have helped me. Remember the URI
    object underneath can be your friend.

    1) Keep things relative.
    $c->uri_for("/blah")->path
    $c->uri_for("/blah")->path_query

    2) Change the scheme yourself.
    my $uri = $c->uri_for("/blah");
    $uri->scheme( $my_test ? "http" : "https" );

    -Ashley
    On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For example, clicking on a "logout" button from within my
    application while connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards
    the beauty of uri_for, which I would love to be using for stuff
    like this. Without uri_for, problems arise when you do things like
    test via the built in Perl webserver (the one running on port 3000
    by default) while on the same webserver as my "production"
    application.

    So the real question is, how do I properly refer to my webserver
    and/or application root and include port or SSL flags? I guess I'm
    looking for something like $0 within uri_for.

    -d

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/
    catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Dustin Suchter at Mar 26, 2008 at 8:30 pm
    Can you directly control the port you redirect to? Part of my
    problem is having consistency between the production and test
    environments, which operate on 80/443 and 3000/3000 respectively.

    -d

    Ashley wrote:
    There are two approaches which have helped me. Remember the URI object
    underneath can be your friend.

    1) Keep things relative.
    $c->uri_for("/blah")->path
    $c->uri_for("/blah")->path_query

    2) Change the scheme yourself.
    my $uri = $c->uri_for("/blah");
    $uri->scheme( $my_test ? "http" : "https" );

    -Ashley
    On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some action.
    For example, clicking on a "logout" button from within my application
    while connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards the
    beauty of uri_for, which I would love to be using for stuff like this.
    Without uri_for, problems arise when you do things like test via the
    built in Perl webserver (the one running on port 3000 by default)
    while on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my webserver
    and/or application root and include port or SSL flags? I guess I'm
    looking for something like $0 within uri_for.

    -d

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Ashley Pond V at Mar 26, 2008 at 8:41 pm

    On Mar 26, 2008, at 1:31 PM, Dustin Suchter wrote:
    Can you directly control the port you redirect to? Part of my
    problem is having consistency between the production and test
    environments, which operate on 80/443 and 3000/3000 respectively.
    Don't see why not. Just add in $c->config magick or whatnot as
    necessary.

    perldoc URI

    use URI;
    my $u = URI->new("http://example.com");
    print $u, $/;

    $u->port("3000");
    $u->scheme("https");
    print $u, $/;


    -Ashley
  • KH at Mar 26, 2008 at 8:47 pm
    $c->uri_for pulls it's base path from $c->req->base. Quoting the
    documentation in the code:
    If your application was queried with the URI
    C<http://localhost:3000/some/path> then C<base> is C<http://localhost:3000/
    .
    So, setting $c->req->base to your new base would do the trick for you I
    think.
    You would just do $c->req->base('http://www.mysite.tld:443')

    I'm sure they're are other ways to do this too.

    On Wed, Mar 26, 2008 at 4:31 PM, Dustin Suchter wrote:

    Can you directly control the port you redirect to? Part of my
    problem is having consistency between the production and test
    environments, which operate on 80/443 and 3000/3000 respectively.

    -d

    Ashley wrote:
    There are two approaches which have helped me. Remember the URI object
    underneath can be your friend.

    1) Keep things relative.
    $c->uri_for("/blah")->path
    $c->uri_for("/blah")->path_query

    2) Change the scheme yourself.
    my $uri = $c->uri_for("/blah");
    $uri->scheme( $my_test ? "http" : "https" );

    -Ashley
    On Mar 26, 2008, at 1:13 PM, Dustin Suchter wrote:

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some action.
    For example, clicking on a "logout" button from within my application
    while connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards the
    beauty of uri_for, which I would love to be using for stuff like this.
    Without uri_for, problems arise when you do things like test via the
    built in Perl webserver (the one running on port 3000 by default)
    while on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my webserver
    and/or application root and include port or SSL flags? I guess I'm
    looking for something like $0 within uri_for.

    -d

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/


    --
    do() || do_not(); // try()
    --------------------------------
    Catapultam habeo. Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane
    mittam
    --------------------------------
    http://www.kylehultman.com
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20080326/8514fab9/attachment.htm
  • Byron Young at Mar 26, 2008 at 8:38 pm

    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, March 26, 2008 1:13 PM
    To: The elegant MVC web framework
    Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For
    example, clicking on a "logout" button from within my application
    while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards
    the
    beauty of uri_for, which I would love to be using for stuff like
    this.
    Without uri_for, problems arise when you do things like test via
    the
    built in Perl webserver (the one running on port 3000 by default)
    while
    on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my webserver
    and/or
    application root and include port or SSL flags? I guess I'm looking
    for
    something like $0 within uri_for.

    -d
    Hey Dustin,

    There's actually a neat plugin for doing this called Catalyst::Plugin::RequireSSL. You just include it in your plugins and then call $c->require_ssl() at the top of any actions you want to use SSL for. It will disable itself automatically on the test server, too.

    Cheers,
    Byron
  • Dustin Suchter at Mar 27, 2008 at 6:36 am
    So I like the idea of the plugin, but I'm having a hard time
    installing it. I found one hit on the Internet that with a report of
    someone else having the exact same problem as me, but I don't see
    the solution online:

    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html

    Any ideas?

    Byron Young wrote:
    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, March 26, 2008 1:13 PM
    To: The elegant MVC web framework
    Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For
    example, clicking on a "logout" button from within my application
    while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards
    the
    beauty of uri_for, which I would love to be using for stuff like
    this.
    Without uri_for, problems arise when you do things like test via
    the
    built in Perl webserver (the one running on port 3000 by default)
    while
    on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my webserver
    and/or
    application root and include port or SSL flags? I guess I'm looking
    for
    something like $0 within uri_for.

    -d
    Hey Dustin,

    There's actually a neat plugin for doing this called Catalyst::Plugin::RequireSSL. You just include it in your plugins and then call $c->require_ssl() at the top of any actions you want to use SSL for. It will disable itself automatically on the test server, too.

    Cheers,
    Byron

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Dustin Suchter at Apr 3, 2008 at 1:44 am
    So I tried to look at the source of the test that failed, and I'm
    not sure I even understand what it is doing. Here's the actual error
    message I'm getting:

    t/01use................ok
    t/02pod................skipped: set TEST_POD to enable this test
    t/03podcoverage........skipped: Test::Pod::Coverage 1.04 required
    t/04ssl................1/15
    # Failed test 'redirect uri ok'
    # at t/04ssl.t line 43.
    # got: 'http://localhost:443/ssl/unsecured'
    # expected: 'http://localhost/ssl/unsecured'

    # Failed test 'redirect with params ok'
    # at t/04ssl.t line 47.
    # got: 'http://localhost:443/ssl/unsecured?a=1&a=2&b=3&c=4'
    # expected: 'http://localhost/ssl/unsecured?a=1&a=2&b=3&c=4'
    # Looks like you failed 2 tests of 15.
    t/04ssl................ Dubious, test returned 2 (wstat 512, 0x200)
    Failed 2/15 subtests
    t/05ssl_host...........ok
    t/06remain_in_ssl......ok

    The top error came from:

    40 # test redirect back to http mode
    41 ok( $res = request('https://localhost/ssl/unsecured'),
    'request ok' );
    42 is( $res->code, 302, 'redirect back to http ok' );
    43 is( $res->header('location'),
    'http://localhost/ssl/unsecured', 'redirect uri ok' );

    So I'm guessing that line #41 is trying to request a secure action
    that would normally redirect you back to an insecure place. This
    jives, because it is requesting an HTTPS URL. However, If I am
    right, then why is it considered a failure to end up on a non-secure
    URL? I guess I don't understand what these tests are doing.

    -d





    Those don't make sense to anyone else, either, right? I mean, if you
    are going to request a URL from port 443,

    Dustin Suchter wrote:
    So I like the idea of the plugin, but I'm having a hard time installing
    it. I found one hit on the Internet that with a report of someone else
    having the exact same problem as me, but I don't see the solution online:

    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html

    Any ideas?

    Byron Young wrote:
    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, March 26, 2008 1:13 PM
    To: The elegant MVC web framework
    Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For
    example, clicking on a "logout" button from within my application
    while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally disregards
    the
    beauty of uri_for, which I would love to be using for stuff like
    this.
    Without uri_for, problems arise when you do things like test via
    the
    built in Perl webserver (the one running on port 3000 by default)
    while
    on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my webserver
    and/or
    application root and include port or SSL flags? I guess I'm looking
    for
    something like $0 within uri_for.

    -d
    Hey Dustin,

    There's actually a neat plugin for doing this called
    Catalyst::Plugin::RequireSSL. You just include it in your plugins and
    then call $c->require_ssl() at the top of any actions you want to use
    SSL for. It will disable itself automatically on the test server, too.

    Cheers,
    Byron

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Byron Young at Apr 3, 2008 at 2:12 am

    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, April 02, 2008 5:44 PM
    To: The elegant MVC web framework
    Subject: Re: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    So I tried to look at the source of the test that failed, and I'm
    not sure I even understand what it is doing. Here's the actual
    error
    message I'm getting:

    t/01use................ok
    t/02pod................skipped: set TEST_POD to enable this test
    t/03podcoverage........skipped: Test::Pod::Coverage 1.04 required
    t/04ssl................1/15
    # Failed test 'redirect uri ok'
    # at t/04ssl.t line 43.
    # got: 'http://localhost:443/ssl/unsecured'
    # expected: 'http://localhost/ssl/unsecured'

    # Failed test 'redirect with params ok'
    # at t/04ssl.t line 47.
    # got:
    'http://localhost:443/ssl/unsecured?a=1&a=2&b=3&c=4'
    # expected: 'http://localhost/ssl/unsecured?a=1&a=2&b=3&c=4'
    # Looks like you failed 2 tests of 15.
    t/04ssl................ Dubious, test returned 2 (wstat 512, 0x200)
    Failed 2/15 subtests
    t/05ssl_host...........ok
    t/06remain_in_ssl......ok

    The top error came from:

    40 # test redirect back to http mode
    41 ok( $res = request('https://localhost/ssl/unsecured'),
    'request ok' );
    42 is( $res->code, 302, 'redirect back to http ok' );
    43 is( $res->header('location'),
    'http://localhost/ssl/unsecured', 'redirect uri ok' );

    So I'm guessing that line #41 is trying to request a secure action
    that would normally redirect you back to an insecure place. This
    jives, because it is requesting an HTTPS URL. However, If I am
    right, then why is it considered a failure to end up on a non-
    secure
    URL? I guess I don't understand what these tests are doing.

    -d





    Those don't make sense to anyone else, either, right? I mean, if
    you
    are going to request a URL from port 443,

    Heh, you know, I think I force installed that plugin because those test results looked like false negatives. It has been working fine for me, though. I probably should have investigated it more, but I just went with it and never looked back. I'm going to be installing a bunch of the catalyst modules on another server this week, so I'll let you know if I run into the same thing again, and I'll try to look into it if I have time.

    Byron

    Dustin Suchter wrote:
    So I like the idea of the plugin, but I'm having a hard time
    installing
    it. I found one hit on the Internet that with a report of someone else
    having the exact same problem as me, but I don't see the solution
    online:
    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.
    html
    Any ideas?

    Byron Young wrote:
    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, March 26, 2008 1:13 PM
    To: The elegant MVC web framework
    Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For
    example, clicking on a "logout" button from within my
    application
    while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally
    disregards
    the
    beauty of uri_for, which I would love to be using for stuff
    like
    this.
    Without uri_for, problems arise when you do things like test
    via
    the
    built in Perl webserver (the one running on port 3000 by
    default)
    while
    on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my
    webserver
    and/or
    application root and include port or SSL flags? I guess I'm
    looking
    for
    something like $0 within uri_for.

    -d
    Hey Dustin,

    There's actually a neat plugin for doing this called
    Catalyst::Plugin::RequireSSL. You just include it in your
    plugins and
    then call $c->require_ssl() at the top of any actions you want
    to use
    SSL for. It will disable itself automatically on the test
    server, too.
    Cheers,
    Byron

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-
    bin/mailman/listinfo/catalyst
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-
    bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-
    archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Dustin Suchter at Apr 3, 2008 at 2:15 am
    Nice.

    I'm pretty sure they are false negatives too. I'll try a force
    install and see how it goes when I start actually using the plugin.

    -d

    Byron Young wrote:
    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, April 02, 2008 5:44 PM
    To: The elegant MVC web framework
    Subject: Re: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    So I tried to look at the source of the test that failed, and I'm
    not sure I even understand what it is doing. Here's the actual
    error
    message I'm getting:

    t/01use................ok
    t/02pod................skipped: set TEST_POD to enable this test
    t/03podcoverage........skipped: Test::Pod::Coverage 1.04 required
    t/04ssl................1/15
    # Failed test 'redirect uri ok'
    # at t/04ssl.t line 43.
    # got: 'http://localhost:443/ssl/unsecured'
    # expected: 'http://localhost/ssl/unsecured'

    # Failed test 'redirect with params ok'
    # at t/04ssl.t line 47.
    # got:
    'http://localhost:443/ssl/unsecured?a=1&a=2&b=3&c=4'
    # expected: 'http://localhost/ssl/unsecured?a=1&a=2&b=3&c=4'
    # Looks like you failed 2 tests of 15.
    t/04ssl................ Dubious, test returned 2 (wstat 512, 0x200)
    Failed 2/15 subtests
    t/05ssl_host...........ok
    t/06remain_in_ssl......ok

    The top error came from:

    40 # test redirect back to http mode
    41 ok( $res = request('https://localhost/ssl/unsecured'),
    'request ok' );
    42 is( $res->code, 302, 'redirect back to http ok' );
    43 is( $res->header('location'),
    'http://localhost/ssl/unsecured', 'redirect uri ok' );

    So I'm guessing that line #41 is trying to request a secure action
    that would normally redirect you back to an insecure place. This
    jives, because it is requesting an HTTPS URL. However, If I am
    right, then why is it considered a failure to end up on a non-
    secure
    URL? I guess I don't understand what these tests are doing.

    -d





    Those don't make sense to anyone else, either, right? I mean, if
    you
    are going to request a URL from port 443,

    Heh, you know, I think I force installed that plugin because those test results looked like false negatives. It has been working fine for me, though. I probably should have investigated it more, but I just went with it and never looked back. I'm going to be installing a bunch of the catalyst modules on another server this week, so I'll let you know if I run into the same thing again, and I'll try to look into it if I have time.

    Byron

    Dustin Suchter wrote:
    So I like the idea of the plugin, but I'm having a hard time
    installing
    it. I found one hit on the Internet that with a report of someone else
    having the exact same problem as me, but I don't see the solution online:
    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.
    html
    Any ideas?

    Byron Young wrote:
    -----Original Message-----
    From: Dustin Suchter
    Sent: Wednesday, March 26, 2008 1:13 PM
    To: The elegant MVC web framework
    Subject: [Catalyst] Usage of $c->uri_for and $c->res->redirect

    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some
    action. For
    example, clicking on a "logout" button from within my
    application
    while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");

    The above seems like a fine solution except it totally
    disregards
    the
    beauty of uri_for, which I would love to be using for stuff
    like
    this.
    Without uri_for, problems arise when you do things like test
    via
    the
    built in Perl webserver (the one running on port 3000 by
    default)
    while
    on the same webserver as my "production" application.

    So the real question is, how do I properly refer to my
    webserver
    and/or
    application root and include port or SSL flags? I guess I'm
    looking
    for
    something like $0 within uri_for.

    -d
    Hey Dustin,

    There's actually a neat plugin for doing this called
    Catalyst::Plugin::RequireSSL. You just include it in your
    plugins and
    then call $c->require_ssl() at the top of any actions you want
    to use
    SSL for. It will disable itself automatically on the test
    server, too.
    Cheers,
    Byron

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-
    bin/mailman/listinfo/catalyst
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-
    bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-
    archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Adam Herzog at Apr 3, 2008 at 2:55 am

    On Thu, Mar 27, 2008 at 2:37 AM, Dustin Suchter wrote:
    So I like the idea of the plugin, but I'm having a hard time installing it.
    I found one hit on the Internet that with a report of someone else having
    the exact same problem as me, but I don't see the solution online:

    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html
    The changelog for Catalyst-Runtime includes the following, for
    v5.7011: "Fixed bug where req->base and req->uri would include a port
    number when running in SSL mode."

    If you're running a version prior to 5.7011, try upgrading. If that
    fixes the failing tests, then post back here. It may be the case that
    the version requirement in RequireSSL just needs to be bumped.

    -A

    --
    Adam Herzog
    Email: adam@adamherzog.com
  • Dustin Suchter at Apr 3, 2008 at 3:23 am
    That seems to have fixed the problem. Excellent catch!

    I had Catalyst::Runtime version 5.7010 so I used CPAN to upgrade
    that package which brought me up to 5.7012.

    I don't know of a nice clean way to remove a package you've
    installed with CPAN, but it was easy enough to just run 'test
    Catalyst::Plugin::RequireSSL' and see that it passed test #4 this
    time around.

    -d

    Adam Herzog wrote:
    On Thu, Mar 27, 2008 at 2:37 AM, Dustin Suchter wrote:
    So I like the idea of the plugin, but I'm having a hard time installing it.
    I found one hit on the Internet that with a report of someone else having
    the exact same problem as me, but I don't see the solution online:

    http://www.nntp.perl.org/group/perl.cpan.testers/2007/09/msg631733.html
    The changelog for Catalyst-Runtime includes the following, for
    v5.7011: "Fixed bug where req->base and req->uri would include a port
    number when running in SSL mode."

    If you're running a version prior to 5.7011, try upgrading. If that
    fixes the failing tests, then post back here. It may be the case that
    the version requirement in RequireSSL just needs to be bumped.

    -A
  • Bill Moseley at Mar 26, 2008 at 8:50 pm

    On Wed, Mar 26, 2008 at 01:13:13PM -0700, Dustin Suchter wrote:
    Let's say I want to send people back and forth between an HTTP
    connection and an HTTPS connection on a server based on some action. For
    example, clicking on a "logout" button from within my application while
    connected via HTTPS does something like:

    $c->res->redirect("http://foo.com/");
    Have you looked at the RequireSSL plugin?

    I use a modified version where I add "SSL" to the attributes of the
    actions that need to be SSL. That avoids running my auto() methods
    before the action runs, unlike the plugin on CPAN.

    Under the test server I get this when I go to a secure page:

    [warn] RequireSSL: Would have redirected to https://localhost:3000/some/secure/page

    It's not that great of a setup because the way it works is by sending a
    redirect, but not bad if you only have a few pages that require SSL.

    BTW -- for resources (js, css) that may not be served via the
    application server there's a trick of not specifying https:// or
    http://, but just leave off the scheme. I.e.:

    //resources.example.com/css/print.css

    And that will use whatever the current page scheme is, IIRC.

    --
    Bill Moseley
    moseley@hank.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 26, '08 at 8:11p
activeApr 3, '08 at 3:23a
posts13
users6
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase