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

Previously, SSL on 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 now need adjusting to support /admin/, but additional
code is needed in 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)
Show inline comments
@@ -10,12 +10,17 @@ class ForceCanonicalHostnameMiddleware(object):
        * Performs redirects to strip trailing "index.html"
        * performs redirects based on APPEND_SLASH
        * performs redirects based on site-specific REDIRECT_TABLE
        * 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 = '' % 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]
        new_url = old_url[:]
        # Append a slash if append_slash is set and the URL doesn't have a
        # trailing slash or a file extension.
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
# 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 <>.

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

handler404 = 'modpythoncustom.view404'


urlpatterns = patterns('',
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^$', 'conservancy.frontpage.view'),
    (r'^feeds/(?P<url>.*)/?$', 'django.contrib.syndication.views.feed',
     {'feed_dict': feed_dict}),
    (r'^feeds/?$', 'conservancy.feeds.view'),
    (r'^news(/|$)', include('')),
    (r'^blog(/|$)', include('')),
Show inline comments
deleted file
Show inline comments
deleted file
Show inline comments
deleted file
Show inline comments
deleted file
0 comments (0 inline, 0 general)