Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 5470:40c990159006

mod_http_oauth2: Use error status code when rendering error page Shouldn't include a 200 OK status code when showing an error.
author Kim Alvefur <zash@zash.se>
date Thu, 18 May 2023 13:19:25 +0200
parent 5469:03f393d572fe
child 5471:d4d333cb75b2
comparison
equal deleted inserted replaced
5469:03f393d572fe 5470:40c990159006
55 local _render_html = require"util.interpolation".new("%b{}", st.xml_escape); 55 local _render_html = require"util.interpolation".new("%b{}", st.xml_escape);
56 local function render_page(template, data, sensitive) 56 local function render_page(template, data, sensitive)
57 data = data or {}; 57 data = data or {};
58 data.site_name = site_name; 58 data.site_name = site_name;
59 local resp = { 59 local resp = {
60 status_code = 200; 60 status_code = data.error and data.error.code or 200;
61 headers = { 61 headers = {
62 ["Content-Type"] = "text/html; charset=utf-8"; 62 ["Content-Type"] = "text/html; charset=utf-8";
63 ["Content-Security-Policy"] = "default-src 'self'"; 63 ["Content-Security-Policy"] = "default-src 'self'";
64 ["X-Frame-Options"] = "DENY"; 64 ["X-Frame-Options"] = "DENY";
65 ["Cache-Control"] = (sensitive and "no-store" or "no-cache")..", private"; 65 ["Cache-Control"] = (sensitive and "no-store" or "no-cache")..", private";