|
I am unable to create repositories via the API, as I consistently encounter a 404 error; however, retrieving the repositories functions correctly. |
Replies: 1 comment 1 reply
|
The endpoint itself looks correct — Semaphore does support: and the request body you're sending is also close to what the API expects. Since A couple of things I'd try:
For example: curl -i -X POST \
'http://localhost:3000/api/project/1/repositories' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{
"name": "TestRepo",
"project_id": 1,
"git_url": "https://git.rollenspiel.monster/ansible-playbooks/test.git",
"git_branch": "main",
"ssh_key_id": 0
}'If that works directly against Semaphore but fails through nginx, then the proxy configuration is the likely place to look. I'd also check whether your nginx config has any method-specific rules or Another thing worth checking is the key ID. Semaphore's API expects You can check the available keys with: curl \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://your-semaphore-host/api/project/1/keys'Then use the appropriate ID in So I'd narrow it down in this order:
Because the repository creation route definitely exists in Semaphore, a plain 404 here makes me suspect that the request may not be reaching the expected Semaphore handler. Hope this helps! If you can share the nginx |
Thanks for the detailed analysis — that was a good starting point. I investigated further and found the actual root cause: it's not the reverse proxy or the route at all.
I reproduced it live against my instance (Semaphore 2.19.12, behind nginx):
Specifically: