Skip to content

Add Added the option to use different access lists for custom locations#5282

Open
MioOgbeni wants to merge 1 commit intoNginxProxyManager:developfrom
broker-consulting:feat/custom-acl-for-custom-locations
Open

Add Added the option to use different access lists for custom locations#5282
MioOgbeni wants to merge 1 commit intoNginxProxyManager:developfrom
broker-consulting:feat/custom-acl-for-custom-locations

Conversation

@MioOgbeni
Copy link

Summary

This PR adds support for custom access lists (ACLs) per proxy host location, allowing users to override the parent proxy host's ACL for specific locations.

Problem Context

In nginx-proxy-manager v2.3.1 (very old version that we are using now), users could achieve similar functionality through advanced config by pasting ACL rules into location advanced config. However, when we decide to upgrade to newer versions, we noticed that this approach became problematic because:

  • The new version always adds the parent proxy host's ACL with a deny all rule at the end
  • This deny all rule is rendered before any advanced config at location block, making all other ACL rules ineffective
  • Users lost the ability to have different access controls for different locations within the same proxy host

Solution

Instead of relying on advanced config workarounds, this PR implements a proper UI-driven approach that allows users to:

  • Enable/disable inheritance of the parent proxy host's ACL for each custom location
  • Select a different ACL specifically for that location when inheritance is disabled

Changes Made

Backend Changes

Schema Updates:

  • Added location_count to access list schema for separate counting of access list usage across custom locations of proxy hosts
  • Updated proxy host location schema to include use_parent_access_list, access_list_id, and access_list properties

Core Logic (backend/internal/):

  • access-list.js: Split ACL counting into proxy_host_count and location_count for better visibility/auditability
  • nginx.js: Fixed ACL rendering logic to properly apply location-specific ACLs with correct precedence
  • proxy-host.js: Added location normalization and ACL enrichment functions

Frontend Changes

UI Components:

  • LocationsFields.tsx: Added checkbox to toggle parent ACL inheritance and AccessField dropdown for custom ACL selection
  • Table.tsx: Added separate "Locations" column showing location-specific ACL usage counts

API Models:

  • models.ts: Added locationCount property to AccessList interface

Translations:

  • Added "locations" and "locations.count" keys to all 18 supported languages

API Schema Updates

  • Updated all access list endpoint schemas to include the new location_count property

Testing

  • All existing functionality remains intact
  • New feature works correctly with proper ACL inheritance and overrides
  • ACL usage counts are accurately split between proxy hosts and locations
  • ACL edits/deletes properly re-render affected locations
  • Schema validation passes for all endpoints

Notes

This is my first contribution to the nginx-proxy-manager project. I'm very open to any criticism and code reviews - please let me know if there are any improvements, bugs, or better approaches to implement this feature. The code has been tested in the development environment and appears to work correctly (at least i hope 🤞), but I'm happy to make any necessary adjustments.

@nginxproxymanagerci
Copy link

Docker Image for build 1 is available on DockerHub:

nginxproxymanager/nginx-proxy-manager-dev:pr-5282

Note

Ensure you backup your NPM instance before testing this image! Especially if there are database changes.
This is a different docker image namespace than the official image.

Warning

Changes and additions to DNS Providers require verification by at least 2 members of the community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant