From a3e5200fcf5dbabe5d6d3c1509f94a43b17c15a9 Mon Sep 17 00:00:00 2001
From: pierreozoux <pierre@ozoux.net>
Date: Thu, 15 Jan 2015 19:41:19 +0100
Subject: [PATCH] Fixes wordpress https \o/

---
 dockerfiles/services/wordpress/run-wordpress.sh | 2 +-
 dockerfiles/services/wordpress/wp-config.php    | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dockerfiles/services/wordpress/run-wordpress.sh b/dockerfiles/services/wordpress/run-wordpress.sh
index 2e21d5b..95e5785 100644
--- a/dockerfiles/services/wordpress/run-wordpress.sh
+++ b/dockerfiles/services/wordpress/run-wordpress.sh
@@ -53,7 +53,7 @@ if [[ $DB_CONNECTABLE -eq 0 ]]; then
         echo "=> Installation of Wordpress"
         PASS=`openssl rand -base64 15`
         cd /app
-        wp --allow-root core install --url=${URL} --title=${URL} --admin_user=${EMAIL} --admin_password=${PASS} --admin_email=${EMAIL}
+        wp --allow-root core install --url=https://${URL} --title=${URL} --admin_user=${EMAIL} --admin_password=${PASS} --admin_email=${EMAIL}
         wp --allow-root plugin install wordpress-https
         wp --allow-root plugin activate wordpress-https
         echo "=> Done!"
diff --git a/dockerfiles/services/wordpress/wp-config.php b/dockerfiles/services/wordpress/wp-config.php
index 09d83be..4ff98df 100644
--- a/dockerfiles/services/wordpress/wp-config.php
+++ b/dockerfiles/services/wordpress/wp-config.php
@@ -14,6 +14,10 @@
  * @package WordPress
  */
 
+define('FORCE_SSL_ADMIN', true);
+if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
+       $_SERVER['HTTPS']='on';
+
 // ** MySQL settings - You can get this info from your web host ** //
 /** The name of the database for WordPress */
 define('DB_NAME', getenv('DB_NAME'));
-- 
GitLab