> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/openapi/guides/using-openapi-proxy.md).

# OpenAPI プロキシの使用

GitBook はプロキシできます **テストする** リクエストを、API サーバーが CORS をサポートしていない場合でも動作するようにします。

### これが存在する理由

ブラウザーは、API サーバーが CORS ヘッダーで許可しない限り、クロスオリジンのリクエストをブロックします。CORS を設定しないと、 **テストする** リクエストはブラウザーで失敗します。プロキシはそれらのリクエストを GitBook 経由でサーバー側にルーティングし、この制限を回避します。

### スキーマ全体でプロキシを有効にする

追加する `x-enable-proxy: true` OpenAPI スキーマのルートに。

<pre class="language-yaml"><code class="lang-yaml">openapi: '3.0.3'
<strong>x-enable-proxy: true
</strong>info:
  title: Example API
  version: '1.0.0'
servers:
  - url: https://api.example.com
</code></pre>

### 特定のオペレーションで有効/無効にする

追加する `x-enable-proxy` オペレーションで。

<pre class="language-yaml"><code class="lang-yaml">openapi: '3.0.3'
info:
  title: Example API
  version: '1.0.0'
servers:
  - url: https://api.example.com
paths:
  /reports:
    get:
      summary: レポート一覧
<strong>      x-enable-proxy: true
</strong>      responses:
        '200':
          description: OK
    post:
      summary: レポートを作成
<strong>      x-enable-proxy: false
</strong>      responses:
        '201':
          description: 作成済み
</code></pre>

{% hint style="info" %}
オペレーションレベル `x-enable-proxy` はルートレベルの値より優先されます。
{% endhint %}

### プロキシがサポートするもの

GitBook はすべての `HTTP` メソッド（`GET`, `POST`, `PUT`, `DELETE`, `PATCH`）、ヘッダー、Cookie、リクエスト本文を転送します。

### セキュリティ

プロキシは、スキーマの `servers` 配列に記載された URL にのみリクエストを転送します。任意の URL にアクセスするためには使用できません。

{% hint style="info" %}
必ず `servers` 配列に、テスト対象にしたいすべてのベース URL を含めてください。URL が一覧にない場合、 **テストする** そのホストへのリクエストはプロキシをバイパスします。
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/openapi/guides/using-openapi-proxy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
