# proxy

proxy钩子注册到Fireboom中也为一个API，和funciton的区别是：

* 没有出入参定义，可以为任意类型，如非结构化数据或xml数据
* 不支持实时查询

**推荐优先使用function，funciton满足不了的，再用proxy钩子**。

<figure><img src="/files/XDMbvwy8DyQFSZ6Mo49j" alt=""><figcaption><p>proxy API界面</p></figcaption></figure>

具体操作步骤同 [function](/jin-jie-gou-zi-ji-zhi/han-shu-gou-zi/zu-he-shi-api.md)

示例代码：

{% code title="custom-go/proxy/ping.go" %}

```go
package proxy

import (
	"custom-go/pkg/base"
	"custom-go/pkg/plugins"
	"net/http"
)

func init() {
	plugins.RegisterProxyHook(ping)
}

func ping(hook *base.HttpTransportHookRequest, body *plugins.HttpTransportBody) (*base.ClientResponse, error) {
	// do something here ...
	body.Response = &base.ClientResponse{
		StatusCode: http.StatusOK,
	}
	body.Response.OriginBody = []byte("ok")
	return body.Response, nil
}
```

{% endcode %}

路由规则：

```http
http://localhost:9991/operations/proxy/[proxy-name]

example:: http://localhost:9991/operations/proxy/ping
```

参考：

* fb-admin：<https://github.com/fireboomio/fb-admin/blob/main/backend/custom-go/proxy/bindmenu.go>


---

# Agent Instructions: 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:

```
GET https://docs.fireboom.io/jin-jie-gou-zi-ji-zhi/han-shu-gou-zi/proxys-fei-qi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
