Changed http redirect code from 303 to 302
This commit is contained in:
@ -246,14 +246,14 @@ bool connection_handler(const char *preprefix, const char *col1, const char *col
|
|||||||
log(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m");
|
log(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m");
|
||||||
log_to_file(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m", host);
|
log_to_file(prefix, "\x1B[1m" + req.getMethod() + " " + req.getPath() + "\x1B[0m", host);
|
||||||
|
|
||||||
bool noRedirect = req.getPath().find("/.well-known/acme-challenge/") == 0 || (req.getPath().find("/files/") == 0 && host == "minecraft.necronda.net");
|
bool noRedirect = req.getPath().find("/.well-known/acme-challenge/") == 0 || (req.getPath().find("/files/") == 0);
|
||||||
|
|
||||||
bool redir = true;
|
bool redir = true;
|
||||||
if (!noRedirect) {
|
if (!noRedirect) {
|
||||||
if (getWebRoot(host).empty()) {
|
if (getWebRoot(host).empty()) {
|
||||||
req.redirect(303, "https://www.necronda.net" + req.getPath());
|
req.redirect(303, "https://www.necronda.net" + req.getPath());
|
||||||
} else if (socket->getSocketPort() != 443) {
|
} else if (socket->getSocketPort() != 443) {
|
||||||
req.redirect(303, "https://" + host + req.getPath());
|
req.redirect(302, "https://" + host + req.getPath());
|
||||||
} else {
|
} else {
|
||||||
redir = false;
|
redir = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user