[GH-ISSUE #178] 404 #113

Closed
opened 2026-02-28 01:21:03 +03:00 by kerem · 3 comments
Owner

Originally created by @BoomerB on GitHub (Jun 21, 2018).
Original GitHub issue: https://github.com/tuxis-ie/nsedit/issues/178

Hi,

I installed nsedit on Ubuntu 18.04 with Apache and php-fpm

I did:
git clone https://github.com/tuxis-ie/nsedit.git
cd nsedit/
git checkout tags/v1.1

I created a new domain. Now I wan to edit the SOA record and when I click Save I get an 404 error

PowerDNS logs show the following:

Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api"
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api": 200, body length: 34
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api/v1/servers/localhost/zones/ltq.lab."
Jun 20 22:41:02 pdnsauth pdns_server[2917]: gpgsql Connection successful. Connected to database '' on '/run/postgresql'.
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api/v1/servers/localhost/zones/ltq.lab.": 200, body length: 749
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api"
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api": 200, body length: 34
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api/v1/api/v1/servers/localhost/zones/ltq.lab."
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: No route found for "/api/v1/api/v1/servers/localhost/zones/ltq.lab."
Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Error result for "/api/v1/api/v1/servers/localhost/zones/ltq.lab.": 404

it looks like the prefix was applied twice

Originally created by @BoomerB on GitHub (Jun 21, 2018). Original GitHub issue: https://github.com/tuxis-ie/nsedit/issues/178 Hi, I installed nsedit on Ubuntu 18.04 with Apache and php-fpm I did: git clone https://github.com/tuxis-ie/nsedit.git cd nsedit/ git checkout tags/v1.1 I created a new domain. Now I wan to edit the SOA record and when I click Save I get an 404 error PowerDNS logs show the following: Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api" Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api": 200, body length: 34 Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api/v1/servers/localhost/zones/ltq.lab." Jun 20 22:41:02 pdnsauth pdns_server[2917]: gpgsql Connection successful. Connected to database '' on '/run/postgresql'. Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api/v1/servers/localhost/zones/ltq.lab.": 200, body length: 749 Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api" Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Result for "/api": 200, body length: 34 Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Handling request "/api/v1/api/v1/servers/localhost/zones/ltq.lab." Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: No route found for "/api/v1/api/v1/servers/localhost/zones/ltq.lab." Jun 20 22:41:02 pdnsauth pdns_server[2917]: HTTP: Error result for "/api/v1/api/v1/servers/localhost/zones/ltq.lab.": 404 it looks like the prefix was applied twice
kerem closed this issue 2026-02-28 01:21:03 +03:00
Author
Owner

@dnshs commented on GitHub (Jun 28, 2018):

In includes/class/PdnsApi.php

Remove localhost from

        $api->url = '/localhost/zones';
<!-- gh-comment-id:400869027 --> @dnshs commented on GitHub (Jun 28, 2018): In includes/class/PdnsApi.php Remove localhost from $api->url = '/localhost/zones';
Author
Owner

@BoomerB commented on GitHub (Jul 7, 2018):

Hi,
I did some debugging and the following hack solved the problem for me
Kind Regards

ubuntu@nsedit:~/nsedit$ git diff
diff --git a/includes/class/ApiHandler.php b/includes/class/ApiHandler.php
index 15efef8..5b29acc 100644
--- a/includes/class/ApiHandler.php
+++ b/includes/class/ApiHandler.php
@@ -114,6 +114,12 @@ class ApiHandler {
     public function call() {
         if (substr($this->url, 0, 1) == '/') {
             $this->apiurl();
+           $l=strlen($this->apiurl);
+            if ($l > 0) {
+                if (substr($this->url, 0, $l) === $this->apiurl) {
+                    $this->apiurl='';
+                }
+            }
         } else {
             $this->apiurl = '/';
         }
@@ -121,4 +127,3 @@ class ApiHandler {
         $this->go();
     }
 }
-
ubuntu@nsedit:~/nsedit$ 
<!-- gh-comment-id:403212090 --> @BoomerB commented on GitHub (Jul 7, 2018): Hi, I did some debugging and the following hack solved the problem for me Kind Regards ``` ubuntu@nsedit:~/nsedit$ git diff diff --git a/includes/class/ApiHandler.php b/includes/class/ApiHandler.php index 15efef8..5b29acc 100644 --- a/includes/class/ApiHandler.php +++ b/includes/class/ApiHandler.php @@ -114,6 +114,12 @@ class ApiHandler { public function call() { if (substr($this->url, 0, 1) == '/') { $this->apiurl(); + $l=strlen($this->apiurl); + if ($l > 0) { + if (substr($this->url, 0, $l) === $this->apiurl) { + $this->apiurl=''; + } + } } else { $this->apiurl = '/'; } @@ -121,4 +127,3 @@ class ApiHandler { $this->go(); } } - ubuntu@nsedit:~/nsedit$ ```
Author
Owner

@colbin8r commented on GitHub (Jul 26, 2018):

+1

<!-- gh-comment-id:408217774 --> @colbin8r commented on GitHub (Jul 26, 2018): +1
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/nsedit#113
No description provided.