aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pawel@process-one.net>2022-11-23 16:28:42 +0100
committerPaweł Chmielowski <pawel@process-one.net>2022-11-23 16:28:42 +0100
commite2779e11552d2e2b7dcf8a28576a1f1bee82fdb9 (patch)
tree0d504d7f07cb31019d6d24d5da9deb9016ef8b79
parentAdd hook for mqtt publish event (diff)
Try to redirect access to files mod_conversejs to cdn when there is no local copies
-rw-r--r--src/mod_conversejs.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mod_conversejs.erl b/src/mod_conversejs.erl
index 61cec2322..fba05c1f7 100644
--- a/src/mod_conversejs.erl
+++ b/src/mod_conversejs.erl
@@ -117,7 +117,9 @@ is_served_file(_) -> false.
serve(Host, LocalPath) ->
case get_conversejs_resources(Host) of
- undefined -> ejabberd_web:error(not_found);
+ undefined ->
+ Path = str:join(LocalPath, <<"/">>),
+ {303, [{<<"Location">>, <<"https://cdn.conversejs.org/dist/", Path/binary>>}], <<>>};
MainPath -> serve2(LocalPath, MainPath)
end.