Changeset - 1e119efb7ac2
[Not reviewed]
4 2 0
Bradley Kuhn (bkuhn) - 11 years ago 2013-04-26 17:09:24
bkuhn@ebb.org
Incorporate conservancy_ssl middleware, etc. into main site, now that HTTPS fully supported.

Previously, SSL on sfconservancy.org was supported using a self-signed cert
only to handle the /admin/ portion of the site. Now that SSL is supported
site-wide, and perfectly mirrors the content available via HTTP, the
conservancy_ssl middleware, URLs, and settings are wholly deprecated and
herein removed.

The main site's urls.py now need adjusting to support /admin/, but additional
code is needed in middleware.py to avoid accidentally serving /admin/ via
HTTP instead of HTTPS.

The latter code is untested; hopefully it works "out of the box". :)
6 files changed with 28 insertions and 89 deletions:
0 comments (0 inline, 0 general)
www/conservancy/middleware.py
Show inline comments
...
 
@@ -13,6 +13,11 @@ class ForceCanonicalHostnameMiddleware(object):
 
        * adds cache headers to provide hints to squid
 
        """
 

	
 
        # Never allow connection to the /admin part of the site without SSL
 
        if (not request.is_secure) and request.path.startswith('/admin'):
 
            url = 'https://sfconservancy.org%s' % request.path
 
            return http.HttpResponseRedirect(url)
 

	
 
        # Check for a redirect based on settings.APPEND_SLASH
 
        host = http.get_host(request)
 
        old_url = [host, request.path]
www/conservancy/urls.py
Show inline comments
 
# Copyright 2005-2008, James Garrison
 
# Copyright 2010, 2012 Bradley M. Kuhn
 

	
 
# This software's license gives you freedom; you can copy, convey,
 
# propagate, redistribute, modify and/or redistribute modified versions of
 
# this program under the terms of the GNU Affero General Public License
 
# (AGPL) as published by the Free Software Foundation (FSF), either
 
# version 3 of the License, or (at your option) any later version of the
 
# AGPL published by the FSF.
 
#
 
# This program is distributed in the hope that it will be useful, but
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero
 
# General Public License for more details.
 
#
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program in a file in the toplevel directory called
 
# "AGPLv3".  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from django.conf.urls.defaults import *
 
from conservancy.feeds import feed_dict
 

	
 
handler404 = 'modpythoncustom.view404'
 

	
 
admin.autodiscover()
 

	
 
urlpatterns = patterns('',
 
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
    (r'^admin/(.*)', admin.site.root),
 
    (r'^$', 'conservancy.frontpage.view'),
 
    (r'^feeds/(?P<url>.*)/?$', 'django.contrib.syndication.views.feed',
 
     {'feed_dict': feed_dict}),
www/conservancy_ssl/__init__.py
Show inline comments
 
deleted file
www/conservancy_ssl/middleware.py
Show inline comments
 
deleted file
www/conservancy_ssl/settings.py
Show inline comments
 
deleted file
www/conservancy_ssl/urls.py
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)