Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 22, 2010 22:08:11

Jakob H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SSL through WSGI


Hi, I have a related SSL question using WSGI and Apache.

In my .htaccess file I have something like this:

RewriteEngine On
RewriteBase /
RewriteRule ^(adminmedia/.*)$ -
RewriteRule ^(django\.fcgi/.*)$ -
RewriteCond %{REQUEST_FILENAME} !^/?resources/
RewriteRule ^(.*)$ django.fcgi/$1
SetEnvIf X-Url-Scheme https HTTPS=1

And in my django.wsgi file I have something like this:

import sys, os
sys.path.insert(0,...)
os.environ = ...
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

Whenever I request a 'resource' file usinghttps://.org/resources/...
SSL works fine. This is because WSGI is not involved and the request
is handled by Apache directly. However, whenever something is passed
through WSGI and rendered by the Django engine, all requests using the
HTTPS protocol are automatically forwarded to using the HTTP protocol,
and why sites are not served using SSL. Why does this happen? Where do
I go wrong?

Thanks,
Jakob

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 23, 2010 20:44:43

Mike S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SSL through WSGI


On Wednesday, December 22, 2010 05:08:05 pm Jakob H wrote:
> Hi, I have a related SSL question using WSGI and Apache.
>
> In my .htaccess file I have something like this:

If you are using WSGI, then you'll probably have to look at Apache's config
files (usually in /etc/apache2 or /etc/httpd for the problem and not .htaccess.

More than likely it's as simple as not automatically redirecting http requests
to https for your domain (or vhost) as appropriate.

Also, most of the directives in your .htaccess appear to be fast-cgi and not
wsgi settings, so I'd probably first check to see you really are using
mod_wsgi. You may be able to simplify that .htaccess file a bunch.

--
Mike Seidle

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 24, 2010 01:59:29

Jakob H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

SSL through WSGI


On Dec 23, 3:41 pm, Mike Seidle <m...@seidle.net> wrote:
> On Wednesday, December 22, 2010 05:08:05 pm Jakob H wrote:
>
> > Hi, I have a related SSL question using WSGI and Apache.
>
> > In my .htaccess file I have something like this:
>
> If you are using WSGI, then you'll probably have to look at Apache's config
> files (usually in /etc/apache2 or /etc/httpd for the problem and not
> .htaccess.  
>

I'm running on a shared hosting service (Bluehost) so all I have
available to change is .htaccess.

> More than likely it's as simple as not automatically redirecting http requests
> to https for your domain (or vhost) as appropriate.

What do you mean by this? When I request a static file that doesn't go
through WSGI everything works fine. Can there still be something wrong
about the Apache configuration do you think?

>
> Also, most of the directives in your .htaccess appear to be fast-cgi and not
> wsgi settings, so I'd probably first check to see you really are using
> mod_wsgi. You may be able to simplify that .htaccess file a bunch.

I've also had:

from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

in the django.wsgi file, which doesn't change anything.

Thanks for your help,
Jakob

>
> --
> Mike Seidle

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 19th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support