Bad request when users goto http://www.mydomain.com:443

We get the following error:

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Hint: https://www.mydomain.com/

When users go to http//www.mydomain.com:443 - which we obviously need to
catch and redirect to https://www.mydomain.com

What's the best way of achieving this?

We have two virtual hosts setup one on port 80 (which is already
redirecting http traffic on port 80 to https on port 443) and one on
443.
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users [at] modssl.org
Automated List Manager majordomo [at] modssl.org
Dean Pullen [ Mo, 31 März 2008 18:34 ] [ ID #1931660 ]

Re: Bad request when users goto http://www.mydomain.com:443

Possibly use a RewriteRule or something of the sort?=0A=0ARewriteEngine On=
=0ARewriteCond %{HTTP_HOST} .=0ARewriteCond %{HTTP_HOST} ^www\.mydomain\.co=
m$=0ARewriteCond %{SERVER_PORT} ^443$=0ARewriteRule ^(.*) https://www.mydom=
ain.com/$1 [R=3D301,L]=0A=0AI've not tested that, and I doub't it's spot on=
but hopefully it's the right direction...=0A=0A----- Original Message ----=
=0A> From: Dean Pullen <dean.pullen [at] msp-uk.com>=0A> To: modssl-users [at] modssl=
...org=0A> Sent: Monday, 31 March, 2008 5:34:38 PM=0A> Subject: Bad request w=
hen users goto http://www.mydomain.com:443=0A> =0A> We get the following er=
ror:=0A> =0A> Bad Request=0A> =0A> Your browser sent a request that this se=
rver could not understand.=0A> Reason: You're speaking plain HTTP to an SSL=
-enabled server port.=0A> Instead use the HTTPS scheme to access this URL, =
please.=0A> =0A> Hint: https://www.mydomain.com/=0A> =0A> When users go=
to http//www.mydomain.com:443 - which we obviously need to=0A> catch and r=
edirect to https://www.mydomain.com =0A> =0A> What's the best way of achiev=
ing this?=0A> =0A> We have two virtual hosts setup one on port 80 (which is=
already=0A> redirecting http traffic on port 80 to https on port 443) and =
one on=0A> 443. =0A> ______________________________________________________=
________________=0A> Apache Interface to OpenSSL (mod_ssl) =
www.modssl.org=0A> User Support Mailing List modssl-=
users [at] modssl.org=0A> Automated List Manager majo=
rdomo [at] modssl.org=0A> =0A=0A=0A=0A=0A _________________________________=
_________________________=0ASent from Yahoo! Mail.=0AA Smarter Inbox http:/=
/uk.docs.yahoo.com/nowyoucan.html

____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users [at] modssl.org
Automated List Manager majordomo [at] modssl.org
Glyn Astill [ Mo, 31 März 2008 19:06 ] [ ID #1931661 ]

Re: Bad request when users goto http://www.mydomain.com:443

The rewriterule can be explointed on unpatched Apache. If you're
doing this, make certain you're working with the current patch.

Otherwise, use an application layer redirector/load balancer.

Walt

On 3/31/08, Glyn Astill <glynastill [at] yahoo.co.uk> wrote:
> Possibly use a RewriteRule or something of the sort?
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} .
> RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
> RewriteCond %{SERVER_PORT} ^443$
> RewriteRule ^(.*) https://www.mydomain.com/$1 [R=301,L]
>
> I've not tested that, and I doub't it's spot on but hopefully it's the right direction...
>
> ----- Original Message ----
> > From: Dean Pullen <dean.pullen [at] msp-uk.com>
> > To: modssl-users [at] modssl..org
> > Sent: Monday, 31 March, 2008 5:34:38 PM
> > Subject: Bad request when users goto http://www.mydomain.com:443
> >
> > We get the following error:
> >
> > Bad Request
> >
> > Your browser sent a request that this server could not understand.
> > Reason: You're speaking plain HTTP to an SSL-enabled server port.
> > Instead use the HTTPS scheme to access this URL, please.
> >
> > Hint: https://www.mydomain.com/
> >
> > When users go to http//www.mydomain.com:443 - which we obviously need to
> > catch and redirect to https://www.mydomain.com
> >
> > What's the best way of achieving this?
> >
> > We have two virtual hosts setup one on port 80 (which is already
> > redirecting http traffic on port 80 to https on port 443) and one on
> > 443.
> > ____________________________________________________________ __________
> > Apache Interface to OpenSSL (mod_ssl) www.modssl.org
> > User Support Mailing List modssl-users [at] modssl.org
> > Automated List Manager majordomo [at] modssl.org
> >
>
>
>
>
> __________________________________________________________
> Sent from Yahoo! Mail.
> A Smarter Inbox http://uk.docs.yahoo.com/nowyoucan.html
>
> ____________________________________________________________ __________
> Apache Interface to OpenSSL (mod_ssl) www.modssl.org
> User Support Mailing List modssl-users [at] modssl.org
> Automated List Manager majordomo [at] modssl.org
>


--
Walt Williams, CISSP, SSCP
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users [at] modssl.org
Automated List Manager majordomo [at] modssl.org
walt.williams [ Mo, 31 März 2008 19:18 ] [ ID #1931662 ]
Webserver » gmane.comp.apache.mod-ssl.user » Bad request when users goto http://www.mydomain.com:443

Vorheriges Thema: mod_ssl 2.2.3
Nächstes Thema: Problem in configuring Weblogic with ssl enabled apache