Show More
@@ -46,6 +46,7 b' lang=en' | |||
|
46 | 46 | cache_dir = %(here)s/data |
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | 48 | cut_off_limit = 256000 |
|
49 | force_https = false | |
|
49 | 50 | |
|
50 | 51 | #################################### |
|
51 | 52 | ### CELERY CONFIG #### |
@@ -46,6 +46,7 b' lang=en' | |||
|
46 | 46 | cache_dir = %(here)s/data |
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | 48 | cut_off_limit = 256000 |
|
49 | force_https = false | |
|
49 | 50 | |
|
50 | 51 | #################################### |
|
51 | 52 | ### CELERY CONFIG #### |
@@ -47,6 +47,7 b' cache_dir = %(here)s/data' | |||
|
47 | 47 | index_dir = %(here)s/data/index |
|
48 | 48 | app_instance_uuid = ${app_instance_uuid} |
|
49 | 49 | cut_off_limit = 256000 |
|
50 | force_https = false | |
|
50 | 51 | |
|
51 | 52 | #################################### |
|
52 | 53 | ### CELERY CONFIG #### |
@@ -59,7 +59,7 b' def make_app(global_conf, full_stack=Tru' | |||
|
59 | 59 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) |
|
60 | 60 | |
|
61 | 61 | #enable https redirets based on HTTP_X_URL_SCHEME set by proxy |
|
62 | app = HttpsFixup(app) | |
|
62 | app = HttpsFixup(app, config) | |
|
63 | 63 | |
|
64 | 64 | # Establish the Registry for this application |
|
65 | 65 | app = RegistryManager(app) |
@@ -0,0 +1,29 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | rhodecode.lib.__init__ | |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
|
5 | ||
|
6 | Some simple helper functions | |
|
7 | ||
|
8 | :created_on: Jan 5, 2011 | |
|
9 | :author: marcink | |
|
10 | :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
11 | :license: GPLv3, see COPYING for more details. | |
|
12 | """ | |
|
13 | # This program is free software; you can redistribute it and/or | |
|
14 | # modify it under the terms of the GNU General Public License | |
|
15 | # as published by the Free Software Foundation; version 2 | |
|
16 | # of the License or (at your opinion) any later version of the license. | |
|
17 | # | |
|
18 | # This program is distributed in the hope that it will be useful, | |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
21 | # GNU General Public License for more details. | |
|
22 | # | |
|
23 | # You should have received a copy of the GNU General Public License | |
|
24 | # along with this program; if not, write to the Free Software | |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
|
26 | # MA 02110-1301, USA. | |
|
27 | ||
|
28 | def str2bool(v): | |
|
29 | return v.lower() in ["yes", "true", "t", "1"] if v else None |
@@ -35,15 +35,13 b' from hashlib import md5' | |||
|
35 | 35 | from decorator import decorator |
|
36 | 36 | from vcs.utils.lazy import LazyProperty |
|
37 | 37 | |
|
38 | from rhodecode.lib import str2bool | |
|
38 | 39 | from rhodecode.lib.pidlock import DaemonLock, LockHeld |
|
39 | 40 | |
|
40 | 41 | from pylons import config |
|
41 | 42 | |
|
42 | 43 | log = logging.getLogger(__name__) |
|
43 | 44 | |
|
44 | def str2bool(v): | |
|
45 | return v.lower() in ["yes", "true", "t", "1"] if v else None | |
|
46 | ||
|
47 | 45 | try: |
|
48 | 46 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) |
|
49 | 47 | except KeyError: |
@@ -25,9 +25,12 b'' | |||
|
25 | 25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
26 | 26 | # MA 02110-1301, USA. |
|
27 | 27 | |
|
28 | from rhodecode.lib import str2bool | |
|
29 | ||
|
28 | 30 | class HttpsFixup(object): |
|
29 | def __init__(self, app): | |
|
31 | def __init__(self, app, config): | |
|
30 | 32 | self.application = app |
|
33 | self.config = config | |
|
31 | 34 | |
|
32 | 35 | def __call__(self, environ, start_response): |
|
33 | 36 | self.__fixup(environ) |
@@ -41,6 +44,9 b' class HttpsFixup(object):' | |||
|
41 | 44 | """ |
|
42 | 45 | proto = environ.get('HTTP_X_URL_SCHEME') |
|
43 | 46 | |
|
47 | if str2bool(self.config.get('force_https')): | |
|
48 | proto = 'https' | |
|
49 | ||
|
44 | 50 | if proto == 'https': |
|
45 | 51 | environ['wsgi.url_scheme'] = proto |
|
46 | 52 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now