Re: automatic redirect to https
Aaron J Mackey wrote: > Yes: simply because I want to be able to install the software at new > sites with minimal httpd.conf twiddling (and the user has a configuration > file in which they can switch on/off the SSL requirement). in that case, you probably want to check $r->subprocess_env('HTTPS') instead of $ENV{HTTPS}, since PerlSetupEnv Off will cause $ENV{HTTPS} to be false. --Geoff
RE: automatic redirect to https
Yes: simply because I want to be able to install the software at new sites with minimal httpd.conf twiddling (and the user has a configuration file in which they can switch on/off the SSL requirement). Thanks for the easier answer though - it should probably be the first answer in the FAQ (is there a FAQ file somewhere that I could patch in the answers to this question and send it to someone?) -Aaron On Mon, 13 May 2002, Christian Gilmore wrote: > Is there a reason you don't just use a Redirect? > > > Redirect/ https://secure.server.com/ > > > Regards, > Christian > > - > Christian Gilmore > Technology Leader > GeT WW Global Applications Development > IBM Software Group > > > > -Original Message- > > From: Aaron J Mackey [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 13, 2002 1:12 PM > > To: [EMAIL PROTECTED] > > Subject: automatic redirect to https > > > > > > > > Can anyone see something wrong with this, or suggest a better > > mechanism: > > > > unless ( $ENV{HTTPS} ) { > > # bounce request to secure port > > my $uri = $r->parsed_uri(); > > $uri->scheme('https'); > > $r->header_out(Location => $uri->unparse()); > > return REDIRECT; > > } > > > > This doesn't seem to work for me; the browser acts as if it's in an > > eternal redirection loop. And the server's error log says > > that a child > > segfaulted in the process. The $uri->unparse yields a string like > > "https:/mydirectory" when I access > > "http://myserver.org/mydirectory";. Do > > I need to rebuild the entire URI manually? > > > > Thanks, > > > > -Aaron > >
RE: automatic redirect to https
Is there a reason you don't just use a Redirect? Redirect / https://secure.server.com/ Regards, Christian - Christian Gilmore Technology Leader GeT WW Global Applications Development IBM Software Group > -Original Message- > From: Aaron J Mackey [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 13, 2002 1:12 PM > To: [EMAIL PROTECTED] > Subject: automatic redirect to https > > > > Can anyone see something wrong with this, or suggest a better > mechanism: > > unless ( $ENV{HTTPS} ) { > # bounce request to secure port > my $uri = $r->parsed_uri(); > $uri->scheme('https'); > $r->header_out(Location => $uri->unparse()); > return REDIRECT; > } > > This doesn't seem to work for me; the browser acts as if it's in an > eternal redirection loop. And the server's error log says > that a child > segfaulted in the process. The $uri->unparse yields a string like > "https:/mydirectory" when I access > "http://myserver.org/mydirectory";. Do > I need to rebuild the entire URI manually? > > Thanks, > > -Aaron >
Re: automatic redirect to https
On Mon, 13 May 2002, Geoffrey Young wrote: > hmm, that's interesting - I guess you're catching a setting? > If > so, there's probably not much you can do about it save something like > > my $uri = Apache:URI->parse($r); > $uri->hostname($r->headers_in->get('Host')); That did the trick - the browser is now redirected correctly, thanks. -Aaron
Re: automatic redirect to https
Aaron J Mackey wrote: > On Mon, 13 May 2002, Geoffrey Young wrote: > > >>my $uri = Apache::URI->parse($r); >> > > Well, now $uri->unparse yields this: "null: https://_default_/mydirectory"; > > Which of course doesn't work in the Location field of the redirect. I can > munge this as I need, but I was hoping for something cleaner. hmm, that's interesting - I guess you're catching a setting? If so, there's probably not much you can do about it save something like my $uri = Apache:URI->parse($r); $uri->hostname($r->headers_in->get('Host')); if you can, adding a ServerName directive might make things work as well, but I suppose that defeats the purpose of _default_ :) at this point, however, there may not be a more elegant solution since Apache::URI->parse() relies on Apache API calls for most of its information. HTH --Geoff
Re: automatic redirect to https
On Mon, 13 May 2002, Geoffrey Young wrote: > my $uri = Apache::URI->parse($r); Well, now $uri->unparse yields this: "null: https://_default_/mydirectory"; Which of course doesn't work in the Location field of the redirect. I can munge this as I need, but I was hoping for something cleaner. -Aaron -- Aaron J Mackey Pearson Laboratory University of Virginia (434) 924-2821 [EMAIL PROTECTED]
Re: automatic redirect to https
Aaron J Mackey wrote: > Can anyone see something wrong with this, or suggest a better mechanism: > > unless ( $ENV{HTTPS} ) { > # bounce request to secure port > my $uri = $r->parsed_uri(); > $uri->scheme('https'); > $r->header_out(Location => $uri->unparse()); > return REDIRECT; > } > > This doesn't seem to work for me; the browser acts as if it's in an > eternal redirection loop. And the server's error log says that a child > segfaulted in the process. The $uri->unparse yields a string like > "https:/mydirectory" when I access "http://myserver.org/mydirectory";. Do > I need to rebuild the entire URI manually? no. try this instead my $uri = Apache::URI->parse($r); HTH --Geoff
automatic redirect to https
Can anyone see something wrong with this, or suggest a better mechanism: unless ( $ENV{HTTPS} ) { # bounce request to secure port my $uri = $r->parsed_uri(); $uri->scheme('https'); $r->header_out(Location => $uri->unparse()); return REDIRECT; } This doesn't seem to work for me; the browser acts as if it's in an eternal redirection loop. And the server's error log says that a child segfaulted in the process. The $uri->unparse yields a string like "https:/mydirectory" when I access "http://myserver.org/mydirectory";. Do I need to rebuild the entire URI manually? Thanks, -Aaron