> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/external-url.md).

# 外部 URL

### “From External URL”功能

要启用 [“From External URL”](https://www.overleaf.com/learn/how-to/How_to_upload_a_file_using_an_external_URL) 功能，变量 `ENABLED_LINKED_FILE_TYPES` 必须包含 `url` 类型：

```
ENABLED_LINKED_FILE_TYPES=project_file,project_output_file,url
```

这将同时扩展 *添加文件* 菜单以及 *插入图像* 工具栏中的下拉菜单： *添加文件* 菜单允许您使用文件的 URL 将文件添加到项目中，而 *插入图像* 下拉菜单则可让您直接通过图像的 URL 将图像插入文档。

#### 安全说明

当用户在项目中添加外部文件链接时，该文件会代表安装 Overleaf 的服务器被获取。

如果 Overleaf 服务器托管在一个私有网络中，而该网络还包含内部 HTTP 服务器（仅供内部使用），那么有权访问 Overleaf 的用户可能会访问这些内部服务中的数据。

为防止这种情况，外部文件链接不得指向其 IP 地址属于任何受限网络范围的服务器。这些范围包括：

* `127.0.0.0/8` （环回）
* `169.254.0.0/16` （链路本地）
* `10.0.0.0/8` （私有网络）
* `172.16.0.0/12` （私有网络）
* `192.168.0.0/16` （私有网络）

此外，引入了以下环境变量：

* `OVERLEAF_LINKED_URL_BLOCKED_NETWORKS`
  * 以空白字符分隔的、CIDR 表示法的网络列表，禁止从这些网络获取外部资源。通常应包括组织的内部网络。
    * 示例： `OVERLEAF_LINKED_URL_BLOCKED_NETWORKS=123.123.0.0/16 124.124.124.0/24`

但是，在许多组织中，内部网络中的服务器也可能托管应公开访问的数据。即使整个网络被阻止，也要允许访问特定资源时，可使用以下环境变量：

* `OVERLEAF_LINKED_URL_ALLOWED_RESOURCES`
  * 用于定义允许获取外部文件的网页资源的正则表达式。如果某个 URL 匹配该正则表达式，即使其所在网络已被阻止，也会授予访问权限。
    * 示例：要允许如下 URL： `https://www.example.com/~john/pictures/frog.jpg` 和 `http://www.example.com/public/whatever/lit.bib`:

      `OVERLEAF_LINKED_URL_ALLOWED_RESOURCES=^https?://www\.example\.com/(?:~[^/]+|public)(?:/.*)?`
    * 示例：要禁止如下 URL： `http://www.example.com/private/whatever/file`，同时允许所有不在 `私有` 子树中：

      `OVERLEAF_LINKED_URL_ALLOWED_RESOURCES=^https?://www\.example\.com/(?!private)(?:.*)`<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/pei-zhi/overleaf-toolkit/external-url.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
