Skip to content

Commit

Permalink
Merge pull request #2207 from pi-hole/tweak/acme-challenge
Browse files Browse the repository at this point in the history
Do not redirect to login page for ACME challenges
  • Loading branch information
DL6ER authored Feb 19, 2025
2 parents 89bcaf2 + 15cede0 commit 84096f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/webserver/lua_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ int request_handler(struct mg_connection *conn, void *cbdata)
/* Handler may access the request info using mg_get_request_info */
const struct mg_request_info *req_info = mg_get_request_info(conn);

// Do not redirect for ACME challenges
log_info("Local URI: \"%s\"", req_info->local_uri_raw);
const char acme_challenge[] = "/.well-known/acme-challenge/";
const bool is_acme = strncmp(req_info->local_uri_raw, acme_challenge, strlen(acme_challenge)) == 0;
if(is_acme)
{
// ACME challenge - no authentication required
return 0;
}

// Build minimal api struct to check authentication
struct ftl_conn api = { 0 };
api.conn = conn;
Expand Down

0 comments on commit 84096f4

Please sign in to comment.