Restconf in confd

Hi,
I’m trying to enable restconf in confd. Below is my config in confd.conf.

<rest>
<!--CFG_REST--><enabled>false</enabled>
  </rest>
  <restconf>
        <enabled>true</enabled>
        <rootResource>restconf</rootResource>
  </restconf>

  <webui>
      <enabled>true</enabled>
      <transport>
          <tcp>
              <!--CFG_REST--><enabled>false</enabled>
              <ip>127.0.0.1</ip>
              <port>8008</port>
              <extraIpPorts>[::1]</extraIpPorts>
          </tcp>
      </transport>
  </webui>

Still, when I send the request. It’s returning below error. I have reloaded the confd also rebooted the machine

curl -kisu ‘admin:admin’ -X GET -H "Accept:application/yang-data+xml" https://<ip>/restconf/data/restconf-state
HTTP/1.1 404 Not Found
Date: Sat, 16 Nov 2019 12:59:33 GMT
Server: Apache
Expires: Thu, 01 Jan 1970 05:30:00 GMT
Accept-Ranges: bytes
Last-Modified: Wed, 13 Nov 2019 10:07:44 GMT
Content-Type: text/html
Content-Length: 591
Content-Security-Policy: frame-ancestors 'self'
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Permitted-Cross-Domain-Policies: master-only
Strict-Transport-Security: max-age=31536000, includeSubDomains, preload
Cache-Control: no-cache, no-store, must-revalidate, private
Pragma: no-cache

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Page Not Found</title>
    <link href="/core/ui/images/favicon.ico" rel="icon" type="image/ico">
    <link href="/core/ui/css/login.css" rel="stylesheet" type="text/css">
</head>
<body>
    <header>
        <div id="header_login"></div>
        <div id="header_app_name">EMA 8.2</div>
    </header>

    <h1>Sorry, there's been an error.</h1>

    <p><a id="login" href=""><-- Back</a></p>
    <script> document.getElementById("login").href="https://"+document.domain; </script>
</body>
</html>

Not sure, why this is happening. Any thoughts?

You have configured ConfD to listen for tcp connections to 127.0.0.1 port 8008, and then use curl to connect to https://<ip>/restconf/..., i.e. an ssl connection to the default port 443 - that’s not likely to work. It seems there is an Apache server running on that port, nothing to do with ConfD.

Try using http://127.0.0.1:8008/restconf/... instead (obviously this will only work on the same host where ConfD is running).

1 Like

@per that TCP connection isn’t enabled.

<tcp>
              <!--CFG_REST--><enabled>false</enabled>
              <ip>127.0.0.1</ip>
              <port>8008</port>
              <extraIpPorts>[::1]</extraIpPorts>
          </tcp>

and the SSL connection to default port 443 port works fine with REST. It’s not working with RESTCONF.

OK, so you have configured ConfD to not listen on any port, since ssl is disabled by default (and would anyway use port 8888 unless told otherwise).

I don’t know what you are running on port 443 - hopefully you do - but as you can see, it identifies itself as “Apache”:

Is it supposed to run as a proxy in front of ConfD? If so, the problem is likely to be with the proxy configuration.

Thanks @per
I made little progress in this issue.

Yes, Apache server is running as a proxy in front of confd.
As you mentioned it was some configuration miss in Apache server.

Thanks.