> 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-tw/she-ding/overleaf-toolkit/external-url.md).

# 外部 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
```

這將同時擴充 *新增檔案* 選單以及 *插入圖形* 工具列中的下拉式選單： *新增檔案* 選單可讓您使用檔案的網址將檔案新增至專案，而 *插入圖形* 下拉式選單可讓您直接從網址將圖片插入文件。

#### 安全性注意事項

當使用者在其專案中新增外部檔案連結時，系統會代表安裝 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`
  * 一個用來定義允許的網路資源之正規表示式，外部檔案可從這些資源擷取。若某個網址符合此正規表示式，即使其所屬網路已被封鎖，仍會允許存取。
    * 例如：若要允許如下網址 `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)(?:/.*)?`
    * 例如：若要拒絕如下網址 `http://www.example.com/private/whatever/file`，同時允許不在以下範圍內的所有其他資源： `private` 子樹：

      `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-tw/she-ding/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.
