summaryrefslogtreecommitdiff
path: root/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2018-07-30 11:41:43 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-21 22:30:29 +0300
commitef18a48d23e7fcaef501166b0766680519846272 (patch)
treef1cf207f04249e254d778469b328724856ebea36 /meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend
parented734e8c838ce77fd01aa8e9d54f47145b828f37 (diff)
downloadopenbmc-ef18a48d23e7fcaef501166b0766680519846272.tar.xz
webui: serve via nginx
Serve the mostly pre-compressed static webui content via nginx. If nginx can't find a static file, proxy the URI back to the rest server. A follow-up commit will remove code that serves webui from the phosphor-rest-server. Tested: - The webui, rest server and bmcweb seem to be working as before. - curl -H "Accept-Encoding: gzip" https://<witherspoon>/foo.html is served compressed content. - curl https://<witherspoon>/foo.html is served uncompressed content. Change-Id: Ice443f00a467f3558f28d697261df4f23278f420 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend')
-rw-r--r--meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend16
1 files changed, 16 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend
new file mode 100644
index 000000000..ea818947e
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/webui/phosphor-webui.bbappend
@@ -0,0 +1,16 @@
+do_install_append () {
+
+# The webui content is served as pre-compressed gzip content. While nginx can
+# handle this via the gzip_static directive (and we use that), the nginx
+# try_files directive (which we also use) searches the URI as-is. The suggested
+# workaround is to have an empty uncompressed file with the same name as the
+# compressed file. This does not impact the functionality of gzip_static.
+# So for eg if there's an index.html.gz, create an empty index.html. Same goes
+# for all the webui content.
+# https://serverfault.com/questions/571733/nginx-gzip-static-why-are-the-non-compressed-files-required
+# https://www.ruby-forum.com/topic/4402481
+# https://trac.nginx.org/nginx/ticket/1367
+
+find ${D}${datadir}/www -type f -name '*.gz' -exec sh -c 'touch `dirname "$0"`/`basename "$0" .gz`' '{}' \;
+
+}