mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 17:35:52 +03:00
[GH-ISSUE #3568] Adding Access List through the API returns 413 code #2368
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#2368
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @diegocade1 on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3568
Checklist
jc21/nginx-proxy-manager:latestdocker image?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:
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
@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/schemato get a listbut 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....
@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 ?
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 .,..
@github-actions[bot] commented on GitHub (Dec 31, 2024):
Issue is now considered stale. If you want to keep it open, please comment 👍
@github-actions[bot] commented on GitHub (Jan 20, 2026):
Issue was closed due to inactivity.