Commit 4956c213 authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'apache'

parents f7bbd22a 116783d9
......@@ -71,18 +71,12 @@ class Recipe(BaseSlapRecipe):
slave_dict = {}
service_dict = {}
# Check if default port
if frontend_port_number is 443 or frontend_port_number is 80:
port_snippet = ""
else:
port_snippet = ":%s" % frontend_port_number
for slave_instance in slave_instance_list:
backend_url = slave_instance.get("url", None)
reference = slave_instance.get("slave_reference")
# Set scheme (http? https?)
# Future work may allow to choose between http and https (or both?)
scheme = 'https://'
scheme = 'http://'
self.logger.info('processing slave instance: %s' % reference)
......@@ -93,10 +87,12 @@ class Recipe(BaseSlapRecipe):
continue
# Check for custom domain (like mypersonaldomain.com)
# If no custom domain, use generated one
# If no custom domain, use generated one.
domain = slave_instance.get('custom_domain',
"%s.%s" % (reference.replace("-", "").lower(), frontend_domain_name))
slave_dict[reference] = "%s%s%s/" % (scheme, domain, port_snippet)
# Define the URL where the instance will be available
# WARNING: we use default ports (443, 80) here.
slave_dict[reference] = "%s%s/" % (scheme, domain)
# Check if we want varnish+stunnel cache.
if slave_instance.get("enable_cache", "").upper() in ('1', 'TRUE'):
......@@ -455,7 +451,7 @@ class Recipe(BaseSlapRecipe):
return stunnel_conf
def installFrontendApache(self, ip_list, key, certificate, name,
port, plain_http_port=8080,
port=4443, plain_http_port=8080,
rewrite_rule_list=[], rewrite_rule_zope_list=[],
access_control_string=None):
# Create htdocs, populate it with default 404 document
......
......@@ -34,6 +34,7 @@ CustomLog "%(access_log)s" common
#LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
......@@ -89,19 +90,12 @@ Header append Vary User-Agent
# SSL Configuration
%(ssl_snippet)s
# Dummy virtualhost redirecting to https. Note: will work only if https listens
# on standard port (443)
<VirtualHost *:%(plain_http_port)s>
RewriteEngine On
# Not using HTTPS? Ask that guy over there.
RewriteRule ^/(.*)$ https://%%{SERVER_NAME}%%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:%(https_port)s>
SSLEngine on
SSLProxyEngine on
# Rewrite part
ProxyVia On
ProxyPreserveHost On
ProxyTimeout 600
RewriteEngine On
......@@ -122,6 +116,21 @@ Header append Vary User-Agent
ErrorDocument 404 /notfound.html
</VirtualHost>
<VirtualHost *:%(plain_http_port)s>
RewriteEngine On
ProxyPreserveHost On
# We accept generic (i.e not lamp) backends on http
RewriteMap apachemapgeneric txt:%(apachemap_path)s
RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >""
RewriteRule ^/(.*)$ ${apachemapgeneric:%%{SERVER_NAME}}/$1 [L,P]
# Not using HTTPS? Ask that guy over there.
# Dummy redirection to https. Note: will work only if https listens
# on standard port (443).
RewriteRule ^/(.*)$ https://%%{SERVER_NAME}%%{REQUEST_URI}
</VirtualHost>
# Include configuration file not operated by slapos. This file won't be erased
# or changed when slapgrid is ran. It can be freely customized by node admin.
Include %(custom_apache_conf)s
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment