forcing https

20 views
Skip to first unread message

Josh Stratton

unread,
Sep 6, 2011, 10:18:36 AM9/6/11
to mod...@googlegroups.com
My employer recently setup an SSL certificate for a domain I just
setup using mod_wsgi, apache, and django. I've tried putting a
redirect in the wsgi.conf file to setup a redirect to https, but
doesn't seem to be working...

WSGIDaemonProcess test processes=1 threads=1
python-path=/home/net/public_html/:/home/net/public_html/managio
WSGIProcessGroup test
WSGIScriptAlias / /home/net/public_html/managio.wsgi
<Directory "/home/stratton/public_html">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>

RedirectMatch http://(.*) https://$1

I'm new to SSL and I don't know if I'm missing a bigger issue, but
basically everything needs to redirect to SSL-enabled connection,
which I assume apache recognizes when the URL is prefixed with https.

Graham Dumpleton

unread,
Sep 6, 2011, 10:39:09 AM9/6/11
to mod...@googlegroups.com
On 6 September 2011 07:18, Josh Stratton <stratto...@gmail.com> wrote:
> My employer recently setup an SSL certificate for a domain I just
> setup using mod_wsgi, apache, and django.  I've tried putting a
> redirect in the wsgi.conf file to setup a redirect to https, but
> doesn't seem to be working...
>
> WSGIDaemonProcess test processes=1 threads=1
> python-path=/home/net/public_html/:/home/net/public_html/managio
> WSGIProcessGroup test
> WSGIScriptAlias / /home/net/public_html/managio.wsgi
> <Directory "/home/stratton/public_html">
>  Options Indexes MultiViews FollowSymLinks
>  AllowOverride None
>  Order allow,deny
>  allow from all
> </Directory>
>
> RedirectMatch http://(.*) https://$1

The string matched against the pattern will not include 'http://host".
That is why it isn't going to match.

Googling yields various approaches to this. First is to add in to port
80 VirtualHost:

Redirect permanent / https://mail.nixcraft.com/

where target host would be changed to yours.

Another is to use:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Graham

> I'm new to SSL and I don't know if I'm missing a bigger issue, but
> basically everything needs to redirect to SSL-enabled connection,
> which I assume apache recognizes when the URL is prefixed with https.
>

> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>

Emyr James

unread,
Sep 9, 2011, 11:12:56 AM9/9/11
to mod...@googlegroups.com
I have..

<VirtualHost *:80>
ServerName my.server.name
RewriteEngine On
RewriteRule ^(.*)$ https://my.server.name$1 [R,L]
</VirtualHost>

in my port 80 default virtual host and it works fine.

Reply all
Reply to author
Forward
0 new messages