You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crail.apache.org by pe...@apache.org on 2021/09/23 07:57:01 UTC

[incubator-crail-website] branch master updated: Enable https redirect

This is an automated email from the ASF dual-hosted git repository.

pepperjo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-crail-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 5481049  Enable https redirect
5481049 is described below

commit 5481049c29fbc6b87ca2024fcc7f705cfcc656c9
Author: Jonas Pfefferle <pe...@apache.org>
AuthorDate: Thu Sep 23 09:43:23 2021 +0200

    Enable https redirect
    
    Use .htaccess to enable http -> https redirect.
    This file was adopted from the calcite project.
---
 publish.sh                   |  2 +-
 publish.sh => site/.htaccess | 43 +++++++++++++++++--------------------------
 site/_config.yml             |  2 ++
 3 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/publish.sh b/publish.sh
index fe8cc8b..6a7fe33 100755
--- a/publish.sh
+++ b/publish.sh
@@ -28,7 +28,7 @@ git branch --set-upstream-to=origin/asf-site asf-site
 git pull --rebase
 rm -rf content
 mkdir content
-mv site/_site/* content
+mv site/_site/* site/_site/.htaccess content
 git add content
 echo "Publishing changes from master branch $COMMIT_HASH"
 git commit -a -m "Publishing from $COMMIT_HASH"
diff --git a/publish.sh b/site/.htaccess
old mode 100755
new mode 100644
similarity index 55%
copy from publish.sh
copy to site/.htaccess
index fe8cc8b..4d60da8
--- a/publish.sh
+++ b/site/.htaccess
@@ -1,5 +1,3 @@
-#!/usr/bin/env bash
-#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -14,28 +12,21 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-#
-# copied from: https://github.com/apache/bahir-website/blob/master/publish.sh
 
-set -e
-cd site
-bundle exec jekyll clean
-bundle exec jekyll build -d _site
-COMMIT_HASH=`git rev-parse HEAD`
-cd ..
-git checkout asf-site
-git branch --set-upstream-to=origin/asf-site asf-site
-git pull --rebase
-rm -rf content
-mkdir content
-mv site/_site/* content
-git add content
-echo "Publishing changes from master branch $COMMIT_HASH"
-git commit -a -m "Publishing from $COMMIT_HASH"
-echo "> > >"
-echo " "
-echo "You are now on the asf-site branch"
-echo "Run git push origin asf-site to update the live site."
-echo " "
-echo " "
-set +e
+RewriteEngine On
+
+# This is a 301 (permanent) redirect from HTTP to HTTPS.
+
+# The next rule applies conditionally:
+# * the host is "crail.apache.org",
+# * the host comparison is case insensitive (NC),
+# * HTTPS is not used.
+RewriteCond %{HTTP_HOST} ^crail\.apache\.org [NC]
+RewriteCond %{HTTPS} !on
+
+# Rewrite the URL as follows:
+# * Redirect (R) permanently (301) to https://crail.apache.org/,
+# * Stop processing more rules (L).
+RewriteRule ^(.*)$ https://crail.apache.org/$1 [L,R=301]
+
+# End .htaccess
diff --git a/site/_config.yml b/site/_config.yml
index 77a35bf..6da86fe 100644
--- a/site/_config.yml
+++ b/site/_config.yml
@@ -58,3 +58,5 @@ paginate_path: blog/page:num
 #plugins:
 #    - regex_filter
 
+include: ['.htaccess']
+