Add CORS middleware

This commit is contained in:
Brahim Hadriche committed 2022-11-25 13:29:48 -05:00
1 parent 386dfc1419
commit 02e44960b7
4 files changed
+28 -1

No files matched your search

+4
View File
@@ -31,6 +31,7 @@ namespace Http
private buf_start = 0
private http_code = 0
private mimetype = "text/html" ' for errors
private allow_origin
private server
private settings
@@ -145,6 +146,9 @@ namespace Http
if isstr(m.location)
m.header = m.header + "Location: " + m.location + WinNL()
end if
if m.allow_origin <> invalid
m.header = m.header + "Access-Control-Allow-Origin: " + m.allow_origin + WinNL()
end if
m.header = m.header + m.KeepAlive(close) + WinNL()
m.header = m.header + "Content-Length:" + Stri(m.length) + WinNL()
if code = 206