Changes for page 2 Script

Last modified by Devin Chen on 2026/03/10 10:53

From version 21.1
edited by Devin Chen
on 2026/03/10 10:53
Change comment: There is no comment for this version
To version 19.1
edited by Devin Chen
on 2026/03/05 16:05
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -2118,12 +2118,14 @@
2118 2118   local max_redirects = 0 -- Number of redirects to follow (set to 0 for none)
2119 2119   local current_url = req_url
2120 2120  
2121 - local response_body = {}
2122 - local res, code, response_headers = https.request{
2121 + -- Loop to handle potential redirects (currently limited to 0 redirects)
2122 + -- for redirect_count = 0, max_redirects do
2123 + local response_body = {}
2124 + local res, code, response_headers = https.request{
2123 2123   url = current_url,
2124 2124   method = "POST",
2125 2125   headers = {
2126 - ["Content-Type"] = "application/json",
2128 + ["Content-Type"] = "application/json", -- Must be text/plain to bypass CORS preflight
2127 2127   ["Content-Length"] = #request_body
2128 2128   },
2129 2129   source = ltn12.source.string(request_body),