Sign inSign up

forgaoqiang/http_forwarder

By forgaoqiang

•Updated about 7 years ago

HTTP cache and forwarder

Image
1

422

forgaoqiang/http_forwarder repository overview

⁠功能描述

基于Workerman的一个HTTP转发功能镜像,提供HTTP请求的暂存和转发

WORKER_COUNT=10 #默认10个worker进程,可以根据需要调整

  • docker run -dit -p 9900:80 -e WORKER_COUNT=20 forgaoqiang/http_forwarder

⁠添加任务(POST)

注意请求一定是 content-type:application/json 类型的POST请求

POST体

{"url":"http://e.epplink.net/lock/index.php","data":"{"op":"add","reason":"add⁠ a new record","task":"this is the detail task"}","callback_url": "http://e.exxxxxxink.et/lock/index.php"}⁠

url: 转发的URL,要求此url返回 {"code":"1"} 否则会认为任务失败 data: 要转发的内容 callback_url: 如果任务完成需要被通知则填写回调URL(可空),回调内容和下面的查询接口查询到的内容相同

返回

{"code":"1","reason":"success","taskid":"3108"} taskid 表示这个任务的id可以用于查询任务状态

  • 其中status的解释 status 0=>未发送 1=>发送成功 -5=>发送失败(对面服务器未响应) -4=>发送失败对面服务器错误响应

⁠查询接口(GET)

查询某个任务的完成状态(完成的任务默认保留1个小时)包括任务完成情况,以及时间相关信息 http://ipv6center.org:9900/api/task_query?taskid=1732⁠

返回:

{"code":"1","reason":"query success","data":{"taskid":"2535","status":"-5","reason":"Remote server has no response","timestamp_add":"1558056072","timestamp_done":"1558056072"}}

⁠服务状态查询(GET)

http://ipv6center.org:9900/api/service_status⁠ 返回内容

{"task_total":"4000","task_finished":"4000","task_failed":"1996","task_success":2004}

Tag summary

Content type

Image

Digest

Size

68.2 MB

Last updated

about 7 years ago

docker pull forgaoqiang/http_forwarder