> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/zh-tw/she-ding/overleaf-toolkit/external-url.md).

# 外部網址

### 「從外部 URL」功能

若要啟用 [「從外部 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`，同時允許所有其他不在 `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://overleaf-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.
