Software / code / prosody
Comparison
plugins/mod_http.lua @ 7247:44b39c02eb33
plugins/mod_http: Keep query string over automatic redirects
| author | daurnimator <quae@daurnimator.com> |
|---|---|
| date | Mon, 15 Feb 2016 16:28:22 +1100 |
| parent | 6966:3e3a83be7e14 |
| child | 7359:a5a080c12c96 |
comparison
equal
deleted
inserted
replaced
| 7245:210d8329dc70 | 7247:44b39c02eb33 |
|---|---|
| 45 :gsub("%$(%w+)", { host = host_module.host }); | 45 :gsub("%$(%w+)", { host = host_module.host }); |
| 46 end | 46 end |
| 47 | 47 |
| 48 local function redir_handler(event) | 48 local function redir_handler(event) |
| 49 event.response.headers.location = event.request.path.."/"; | 49 event.response.headers.location = event.request.path.."/"; |
| 50 if event.request.url.query then | |
| 51 event.response.headers.location = event.response.headers.location .. "?" .. event.request.url.query | |
| 52 end | |
| 50 return 301; | 53 return 301; |
| 51 end | 54 end |
| 52 | 55 |
| 53 local ports_by_scheme = { http = 80, https = 443, }; | 56 local ports_by_scheme = { http = 80, https = 443, }; |
| 54 | 57 |