Re: [netconf] Relative HTTP URLs in RESTCONF's ietf-yang-library `location` leafs

Kent Watsen <kent+ietf@watsen.net> Fri, 01 March 2024 02:58 UTC

Return-Path: <0100018df7f32499-392fe0b4-64f0-4cdd-b1ad-a994fd0f6a91-000000@amazonses.watsen.net>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0805BC14F61C for <netconf@ietfa.amsl.com>; Thu, 29 Feb 2024 18:58:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.907
X-Spam-Level:
X-Spam-Status: No, score=-6.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SaTb-kGI97ye for <netconf@ietfa.amsl.com>; Thu, 29 Feb 2024 18:58:44 -0800 (PST)
Received: from a48-93.smtp-out.amazonses.com (a48-93.smtp-out.amazonses.com [54.240.48.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id AA854C14F5FE for <netconf@ietf.org>; Thu, 29 Feb 2024 18:58:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1709261923; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=WLVwBe9N6phZCJ1e1IxqMuJiaNPlOovhCMWGSN1T3L4=; b=fJJi4t0arJ3fu3pSK0UTGMpaXWjW0W5wZGqcY7Eb/caceL/Zw66IIvxmLeaQtO+n ei2DTSGSgu41LyaTaFrkO+qZ3Nyf3YtjrwLRDSKoGGbmEIHpgVG/X13gaxJVRM1T6me mUjmprtHrqyIXNOoCTS6aLkNWIvWArFR9ac9ix5w=
From: Kent Watsen <kent+ietf@watsen.net>
Message-ID: <0100018df7f32499-392fe0b4-64f0-4cdd-b1ad-a994fd0f6a91-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F3462135-A6E5-4E63-9A06-81595E3E8DC4"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\))
Date: Fri, 01 Mar 2024 02:58:43 +0000
In-Reply-To: <67362192-7a28-4842-bef5-e88de428b069@cesnet.cz>
Cc: "netconf@ietf.org" <netconf@ietf.org>
To: Jan Kundrát <jan.kundrat=40cesnet.cz@dmarc.ietf.org>
References: <67362192-7a28-4842-bef5-e88de428b069@cesnet.cz>
X-Mailer: Apple Mail (2.3774.400.31)
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
X-SES-Outgoing: 2024.03.01-54.240.48.93
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/0TvyRGG_ge9iZXzGQs-jZCNDmyA>
Subject: Re: [netconf] Relative HTTP URLs in RESTCONF's ietf-yang-library `location` leafs
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Mar 2024 02:58:49 -0000

RFC 6991 defines inet:uri as

  typedef uri {
    type string {
      pattern '[a-z][a-z0-9+.-]*:.*';
    }
    …
  }

Thus a relative URL would be invalid.


FWIW, the restconf-client-server draft [1] defines an "external-endpoint” node to configure the user-facing  endpoint:

            description
              "Identifies contact information for the external
               system that terminates connections before passing
               them through to this server (e.g., a network address
               translator or a load balancer).  These values have
               no effect on the local operation of this server,
               but may be used by the application when needing to
               inform other systems how to contact this server.";

[1] https://datatracker.ietf.org/doc/html/draft-ietf-netconf-restconf-client-server

K.



> On Feb 28, 2024, at 6:56 AM, Jan Kundrát <jan.kundrat=40cesnet.cz@dmarc.ietf.org> wrote:
> 
> Hi,
> we're working on a RESTCONF server [1] on top of sysrepo [2]. Since our server keeps a copy of the YANG source of each module that's implemented or imported, I think it's a good idea to point the URIs in the /ietf-yang-library:yang-library/module-set/{module,import-only-module}/location [3] back to the RESTCONF server itself. That way, RESTCONF clients can fetch the YANG models similarly to how it works over NETCONF with <get-schema>.
> 
> However, this brings up the usual problem which are common to all HTTP apps that are hidden behind reverse proxies, or which are running on devices with "unclear" hostnames, or accessed over "non-standard" means with port forwarding, VPNs, etc -- what is the hostname of the client-facing HTTP server? On deployed web apps, this is usually solved either with an explicit configuration or with some reverse proxy header magic [4].
> 
> Are there any restrictions and/or best practices for these URLs? Is it OK to use a partial HTTP URL (which means "no schema, hostname and port"), for example? Would a standard-compliant RESTCONF client build the target URI based on the context of the original request that fetched the ietf-yang-library data? Are relative URLs supported? The HTTP URL spec provides some basic rules [5] for that, but since these `location` leafs are a few layers on top of the HTTP protocol, I wonder if this behavior is specified somewhere?
> 
> With kind regards,
> Jan
> 
> [1] https://github.com/CESNET/rousette
> [2] https://www.sysrepo.org/
> [3] https://datatracker.ietf.org/doc/html/rfc8525#section-3
> [4] https://serverfault.com/questions/598202/make-nginx-to-pass-hostname-of-the-upstream-when-reverseproxying
> [5] https://datatracker.ietf.org/doc/html/rfc9110#section-4.1
> 
> _______________________________________________
> netconf mailing list
> netconf@ietf.org
> https://www.ietf.org/mailman/listinfo/netconf