--- a/src/server/daemon/location.c Sun Nov 23 15:05:37 2025 +0100 +++ b/src/server/daemon/location.c Tue Nov 25 19:44:58 2025 +0100 @@ -96,7 +96,7 @@ WSLocationMatch match = WS_LOCATION_MATCH_EXACT; cxmutstr match_str; - int regex_flags = REG_EXTENDED | REG_NOSUB; + int regex_flags = REG_EXTENDED; int argc = serverconfig_directive_count_args(obj); if(argc == 2) { // arg0: match type @@ -176,13 +176,13 @@ return 0; } -int location_match(WSLocation *loc, cxstring uri) { +int location_match(WSLocation *loc, cxstring uri, regmatch_t *match) { if(loc->match == WS_LOCATION_MATCH_EXACT) { return !cx_strcmp(loc->match_string, uri); } else if(loc->match == WS_LOCATION_MATCH_PREFIX) { return cx_strprefix(uri, loc->match_string); } else { - return regexec(&loc->regex, uri.ptr, 0, NULL, 0) == 0; + return regexec(&loc->regex, uri.ptr, 0, match, WS_LOCATION_NMATCH) == 0; } return 0; } @@ -195,7 +195,7 @@ ZERO(config, sizeof(WSLocationConfig)); while(loc) { - if(location_match(loc, uri)) { + if(location_match(loc, uri, config->match)) { if(location_apply_config(config, loc)) { return NULL; }