> 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: サンプル 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: サンプル 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、リクエスト本文を。

### セキュリティ

このプロキシは、仕様に記載された URL に対するリクエストのみを転送します `servers` 配列。任意の 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 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://gitbook.com/docs/documentation/ja-gitbook-documentation/kontentsuwosuru/openapi/guides/using-openapi-proxy.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.
