> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/autify-university/advanced/tests-on-private-environments/add-http-headers-and-client-certificate-for-test-execution.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# テスト実行のためにHTTPヘッダとクライアント証明書を追加する

Autify Connect Clientとテスト対象アプリケーションの間にProxyサーバーを配置することで、テスト対象アプリケーションに送信されるHTTPリクエストに任意のリクエストヘッダを付加したり、クライアント証明書を利用したmTLS認証に対応したりできます。

この記事では、Autify Connect Clientとテスト対象アプリケーション間のProxyサーバーとして[mitmproxy](https://mitmproxy.org/)を利用し、AUTに送信されるHTTPリクエストに任意のリクエストヘッダを付加する例およびmTLS認証に対応するためにクライアント証明書を利用する例を紹介します。

※mitmproxyはオープンソースソフトウェアであり、Autifyとの関係はございません。

## 任意のリクエストヘッダを追加する

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-1bbd851b959f0463818e973d195212dc2c1acca4%2Fusing-mitmproxy-for-custom-request-headers_ja\(2\).png?alt=media)

図のようにAutify Connect Clientとテスト対象アプリケーションの間にmitmproxyサーバーを配置します。例えば、セッション管理用のカスタムヘッダを追加するには、まずヘッドレスブラウザ等でセッションを受け取り、次に受け取ったセッションをmitmproxyのヘッダ変更設定に追加しmitmproxyサーバーを起動します。最後にAutify Connect Clientの起動オプションでmitmproxyサーバーをProxyサーバーとして指定しAutify Connect Clientサーバーを起動します。

mitmproxyのヘッダ変更設定については下記の公式ドキュメントをご参照ください。

* [Modify Headers - mitmproxy](https://docs.mitmproxy.org/stable/overview-features/#modify-headers)

Autify Connect Clientとテスト対象アプリケーションの間でプロキシを利用するための設定については下記の記事をご参照ください。

* [Proxyサーバーを利用する場合の設定](https://help.autify.com/nocode-web/autify-university/advanced/tests-on-private-environments/configuration-when-using-a-proxy-server.md)

## クライアント証明書を利用する

![](https://50135409-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fof7cb8AGXhWvWThq3R0w%2Fuploads%2Fgit-blob-da429c90834227f899344fee6c05742c604fe14a%2Fusing-mitmproxy-for-client-certificate_ja\(3\).png?alt=media)

図のようにAutify Connect Clientとテスト対象アプリケーションの間にmitmproxyサーバーを配置します。クライアント証明書を利用するには、mitmproxyサーバー起動時に使用するクライアント証明書をオプションで指定します。クライアント証明書を設定するとmTLSにおけるハンドシェイク時にクライアント証明書が使用されます。 Autify Connect Clientの起動オプションでmitmproxyサーバーをProxyサーバーとして指定しAutify Connect Clientサーバーを起動します。

mitmproxyにおいてクライアント証明書を設定する方法は下記の公式ドキュメントをご参照ください。

* [Using a client side certificate - mitmproxy](https://docs.mitmproxy.org/stable/concepts-certificates/#using-a-client-side-certificate)

Autify Connect Clientとテスト対象アプリケーションの間でプロキシを利用するための設定については下記の記事をご参照ください。

* [Proxyサーバーを利用する場合の設定](https://help.autify.com/nocode-web/autify-university/advanced/tests-on-private-environments/configuration-when-using-a-proxy-server.md)


---

# 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://help.autify.com/nocode-web/autify-university/advanced/tests-on-private-environments/add-http-headers-and-client-certificate-for-test-execution.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.
