[GH-ISSUE #3568] Adding Access List through the API returns 413 code #2368

Closed
opened 2026-02-26 07:35:17 +03:00 by kerem · 4 comments
Owner

Originally created by @diegocade1 on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3568

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • No
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

When trying to add an Access List through the api (the list has aprx 1512 entries of IPs)

Nginx Proxy Manager Version

To Reproduce
Steps to reproduce the behavior:

  1. Py script with the following:

def add_access_list(name: str, token: str, existing_rule_id: str, *clients: Access_Rule_Client) -> int:
payload = { "name" : name,
"satisfy_any" : True,
"pass_auth" : False,
"items": [],
"clients": [{'address': rule.address, 'directive': rule.directive} for rule in clients]
}
headers = {
'Authorization' : f'Bearer {token}'
}
if existing_rule_id is None:
url = f"http://{BASE_URL}:{BASE_PORT}/api/nginx/access-lists"
response = requests.post(url, json=payload, headers=headers)
#time.sleep(60)
else:
print(f"adding to ruleid : {existing_rule_id}")
url = f"http://{BASE_URL}:{BASE_PORT}/api/nginx/access-lists/{existing_rule_id}"
response = requests.put(url, json=payload, headers=headers)
#time.sleep(60)
if response.status_code in [200, 201]:
response_json = response.json()
id = response_json["id"]
print(f'Successfully {"updated" if existing_rule_id else "created"} rule (id: {id})')
return id
else:
print(f"Error adding access list. ({response.status_code})")
return -1

After executing the script

Adding access list
adding to ruleid : 11
Error adding access list. (413)
(Code 413 Request Entity Too Large)

Expected behavior

That the records are inserted correctly.

Screenshots

Operating System

The script is being executed Ubuntu 22.04.4 LTS

Additional context

Originally created by @diegocade1 on GitHub (Feb 20, 2024). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3568 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - No - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> When trying to add an Access List through the api (the list has aprx 1512 entries of IPs) **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> **To Reproduce** Steps to reproduce the behavior: 1. Py script with the following: def add_access_list(name: str, token: str, existing_rule_id: str, *clients: Access_Rule_Client) -> int: payload = { "name" : name, "satisfy_any" : True, "pass_auth" : False, "items": [], "clients": [{'address': rule.address, 'directive': rule.directive} for rule in clients] } headers = { 'Authorization' : f'Bearer {token}' } if existing_rule_id is None: url = f"http://{BASE_URL}:{BASE_PORT}/api/nginx/access-lists" response = requests.post(url, json=payload, headers=headers) #time.sleep(60) else: print(f"adding to ruleid : {existing_rule_id}") url = f"http://{BASE_URL}:{BASE_PORT}/api/nginx/access-lists/{existing_rule_id}" response = requests.put(url, json=payload, headers=headers) #time.sleep(60) if response.status_code in [200, 201]: response_json = response.json() id = response_json["id"] print(f'Successfully {"updated" if existing_rule_id else "created"} rule (id: {id})') return id else: print(f"Error adding access list. ({response.status_code})") return -1 After executing the script Adding access list adding to ruleid : 11 **Error adding access list. (413)** (Code 413 Request Entity Too Large) **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> That the records are inserted correctly. **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> The script is being executed Ubuntu 22.04.4 LTS **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. -->
kerem 2026-02-26 07:35:17 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@gadget78 commented on GitHub (Mar 23, 2024):

so is this because the API is "unfinished", or just has a bug in this type of configuration ?
been trying to find more info on NPM's API, but there doesn't actually seem to be any official Docs on it ? ..

i found this,
https://documenter.getpostman.com/view/4475423/2s93mBvyLZ#be0769e8-9cd7-4a74-a075-d56c23fd3351
does seem to have most of the API commands, listed, but not all ..

and also found this,
https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1808
showing you can use address npm-admin-ui:81/api/schema to get a list
but this too doesn't actually seem like a full working list ? ...

but it seems this post maybe the best ? ..
https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1790
which links to this https://github.com/NginxProxyManager/nginx-proxy-manager/tree/develop/backend/routes/api

so going by this, im going to presume the API feature is still being formed,
would be perfect if it did have just a few more bugs fixed, and features fully formed,
like the Access List control for one !..

TL;DR;
looking at your code you supplied,
you have "items": [], within the "payload"
which i believe is not needed/understood, so its given that odd error....

<!-- gh-comment-id:2016617178 --> @gadget78 commented on GitHub (Mar 23, 2024): so is this because the API is "unfinished", or just has a bug in this type of configuration ? been trying to find more info on NPM's API, but there doesn't actually seem to be any official Docs on it ? .. i found this, <https://documenter.getpostman.com/view/4475423/2s93mBvyLZ#be0769e8-9cd7-4a74-a075-d56c23fd3351> does seem to have most of the API commands, listed, but not all .. and also found this, https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1808 showing you can use address `npm-admin-ui:81/api/schema` to get a list but this too doesn't actually seem like a full working list ? ... but it seems this post maybe the best ? .. https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1790 which links to this https://github.com/NginxProxyManager/nginx-proxy-manager/tree/develop/backend/routes/api so going by this, im going to presume the API feature is still being formed, would be perfect if it did have just a few more bugs fixed, and features fully formed, like the Access List control for one !.. TL;DR; looking at your code you supplied, you have `"items": [],` within the "payload" which i believe is not needed/understood, so its given that odd error....
Author
Owner

@gadget78 commented on GitHub (Mar 28, 2024):

thought i would follow this up,
i also posted within this "discussion" post here ..
https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/3195

as i DID NEARLY get this working, but it will only "re-create" the list, and will not "add" to to the existing list.
did you get any further with your setup ?

curl -X PUT -H "Content-Type: application/json; charset=UTF-8" -H "Authorization: Bearer eyJhbGciOi...." -d '{ "name": "AccessListName", "satisfy_any": 0, "pass_auth": 0, "clients": [ { "address": "192.168.178.96", "directive": "allow" } ] }' http://192.168.1.5:81/api/nginx/access-lists/2

this works, but it SHOUD add to the existing list, but it re-creates it instead :(
i found the reason why, and explained here
https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/3195#discussioncomment-8972116
just in case this comes up on someones search .,..

<!-- gh-comment-id:2026259808 --> @gadget78 commented on GitHub (Mar 28, 2024): thought i would follow this up, i also posted within this "discussion" post here .. https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/3195 as i DID NEARLY get this working, but it will only "re-create" the list, and will not "add" to to the existing list. did you get any further with your setup ? ``` curl -X PUT -H "Content-Type: application/json; charset=UTF-8" -H "Authorization: Bearer eyJhbGciOi...." -d '{ "name": "AccessListName", "satisfy_any": 0, "pass_auth": 0, "clients": [ { "address": "192.168.178.96", "directive": "allow" } ] }' http://192.168.1.5:81/api/nginx/access-lists/2 ``` this works, but it SHOUD add to the existing list, but it re-creates it instead :( i found the reason why, and explained here https://github.com/NginxProxyManager/nginx-proxy-manager/discussions/3195#discussioncomment-8972116 just in case this comes up on someones search .,..
Author
Owner

@github-actions[bot] commented on GitHub (Dec 31, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2566070801 --> @github-actions[bot] commented on GitHub (Dec 31, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Jan 20, 2026):

Issue was closed due to inactivity.

<!-- gh-comment-id:3770721745 --> @github-actions[bot] commented on GitHub (Jan 20, 2026): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#2368
No description provided.