UrlPolicy

org.llm4s.rag.loader.UrlPolicy
See theUrlPolicy companion object
@Experimental
trait UrlPolicy

Which URLs UrlLoader, WebCrawlerLoader and the crawler's robots.txt fetch may request, and at which addresses.

A loader asks the policy before every request it makes: the seed URL, each crawled link, every redirect hop and robots.txt. The policy answers with the addresses the host may be reached at, and the loader connects to one of those addresses itself (sending the original Host header and, for https, the original server name and certificate check), so a host whose DNS answer changes after the check (DNS rebinding) cannot redirect the connection elsewhere.

UrlPolicy.default is the SSRF check of NetworkSecurity.validateUrl: http and https only, and no host that resolves to a loopback, private, link-local or other non-public address. Its with* setters add an allow-list of hosts, extra blocked hosts or private-network access. An application with other rules implements this trait.

Attributes

Companion
object
Source
UrlPolicy.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Standard

Members list

Value members

Abstract methods

The addresses url may be fetched from, or why it may not be fetched.

The addresses url may be fetched from, or why it may not be fetched.

Attributes

Returns

a non-empty list of addresses, tried in order; the loader never connects to any other

Source
UrlPolicy.scala