forked from cory/tildefriends
httpd: Don't overspecify the redirects.
This commit is contained in:
parent
4d037c02bf
commit
6b3a6ec7c1
@ -1486,17 +1486,9 @@ static void _httpd_endpoint_delete(tf_http_request_t* request)
|
|||||||
static void _httpd_endpoint_root_callback(const char* path, void* user_data)
|
static void _httpd_endpoint_root_callback(const char* path, void* user_data)
|
||||||
{
|
{
|
||||||
tf_http_request_t* request = user_data;
|
tf_http_request_t* request = user_data;
|
||||||
const char* host = tf_http_request_get_header(request, "x-forwarded-host");
|
|
||||||
if (!host)
|
|
||||||
{
|
|
||||||
host = tf_http_request_get_header(request, "host");
|
|
||||||
}
|
|
||||||
|
|
||||||
char url[1024];
|
|
||||||
snprintf(url, sizeof(url), "%s%s%s", request->is_tls ? "https://" : "http://", host, path ? path : "/~core/apps/");
|
|
||||||
const char* headers[] = {
|
const char* headers[] = {
|
||||||
"Location",
|
"Location",
|
||||||
url,
|
path ? path : "/~core/apps/",
|
||||||
};
|
};
|
||||||
tf_http_respond(request, 303, headers, tf_countof(headers) / 2, NULL, 0);
|
tf_http_respond(request, 303, headers, tf_countof(headers) / 2, NULL, 0);
|
||||||
tf_http_request_unref(request);
|
tf_http_request_unref(request);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user