# HG changeset patch # User Matthew Wild # Date 1587378659 -3600 # Node ID 2764beb552cd9fbd1ed73a1617206c8fa0f998fb # Parent fa2a89132dfb03aed8c324f5e08c203a9d759b65 mod_bosh, mod_websocket: Add config options to override GET responses diff -r fa2a89132dfb -r 2764beb552cd plugins/mod_bosh.lua --- a/plugins/mod_bosh.lua Sun Apr 19 13:04:12 2020 +0200 +++ b/plugins/mod_bosh.lua Mon Apr 20 11:30:59 2020 +0100 @@ -511,14 +511,16 @@ end end +local GET_response_body = [[ +

It works! Now point your BOSH client to this URL to connect to Prosody.

+

For more information see Prosody: Setting up BOSH.

+ ]]; + local GET_response = { headers = { content_type = "text/html"; }; - body = [[ -

It works! Now point your BOSH client to this URL to connect to Prosody.

-

For more information see Prosody: Setting up BOSH.

- ]]; + body = module:get_option_string("bosh_get_response_body", GET_response_body); }; module:depends("http"); diff -r fa2a89132dfb -r 2764beb552cd plugins/mod_websocket.lua --- a/plugins/mod_websocket.lua Sun Apr 19 13:04:12 2020 +0200 +++ b/plugins/mod_websocket.lua Mon Apr 20 11:30:59 2020 +0100 @@ -130,6 +130,12 @@ return data; end + +local default_get_response_body = [[Websocket +

It works! Now point your WebSocket client to this URL to connect to Prosody.

+]] +local websocket_get_response_body = module:get_option_string("websocket_get_response_body", default_get_response_body) + function handle_request(event) local request, response = event.request, event.response; local conn = response.conn; @@ -138,9 +144,7 @@ if not request.headers.sec_websocket_key or request.method ~= "GET" then response.headers.content_type = "text/html"; - return [[Websocket -

It works! Now point your WebSocket client to this URL to connect to Prosody.

- ]]; + return websocket_get_response_body; end local wants_xmpp = contains_token(request.headers.sec_websocket_protocol or "", "xmpp");