当前位置: 首页 > news >正文

从化公司网站建设成都小程序定制开发公司

从化公司网站建设,成都小程序定制开发公司,兰州网络运营公司,做精彩网站分析的方向是应用场景#xff1a; 用户请求想要生产的流量打到原有服务的同时#xff0c;打到新开发的服务上试一下 注意的点#xff1a; 1 nginx是不读请求体的#xff0c;需要在配置文件中打开#xff0c;或者读取前调用ngx.req.read_body()#xff0c;然后通过local data ngx.r…应用场景 用户请求想要生产的流量打到原有服务的同时打到新开发的服务上试一下 注意的点 1 nginx是不读请求体的需要在配置文件中打开或者读取前调用ngx.req.read_body()然后通过local data ngx.req.get_body_data()获取 2 header转发时如果原请求里有accept-encoding这样支持压缩的声明返回的是二进制记录日志不方便读取要单独处理下   -- mirror.lua local core require(apisix.core) local http require(resty.http) local json require(apisix.core.json)local plugin_name mirrorlocal schema {type object,properties {uri {type string,},serviceHost {type string,},serviceName {type string,},method {type string,enum {POST, GET},default POST},timeout {type number,default 3000},}, }local _M {version 0.1,priority 98,name plugin_name,schema schema, }function _M.check_schema(conf)local ok, errok, err core.schema.check(schema, conf)if not ok thenreturn false, errendif not conf.serviceHost thenconf.serviceHost conf.serviceNameendif conf.timeout 0 thenconf.timeout 5 * 1000endreturn true end-- timeout in ms local function http_req(method, uri, body, myheaders, timeout)local httpc http.new()if timeout thenhttpc:set_timeout(timeout)endmyheaders[accept-encoding] nilcore.log.info(Mirrored request http uri , uri, method , method)core.log.info(Mirrored request http header , core.json.delay_encode(myheaders))core.log.info(Mirrored request http req param , core.json.delay_encode(body))local res, err httpc:request_uri(uri, {method method,body body,headers myheaders,ssl_verify false})core.log.info(Mirrored request http status , res.status)core.log.info(Mirrored request http body , res.body)return res endfunction _M.access(conf, ctx)core.log.info(Mirrored request start )ngx.req.read_body()local data ngx.req.get_body_data()local req_headers ngx.req.get_headers()req_headers[Host] conf.servicHostcore.log.info(Mirrored request conf , core.json.delay_encode(conf))local method conf.methodif not method or method nil or method thenmethod ngx.req.get_method()endlocal url conf.serviceNameif not conf.uri or conf.uri nil or conf.uri thenurl url .. ngx.var.urielseurl url .. conf.uriendlocal args, err ngx.req.get_uri_args()if G thenlocal first truefor key, val in pairs(args) doif first thenurl url .. ?first falseelseurl url .. endurl url .. key .. .. valendendlocal res,err http_req(method, url, data, req_headers, conf.timeout)core.log.info(Mirrored request end) endreturn _M
http://www.pierceye.com/news/174923/

相关文章:

  • 网站开发的论文引言微信网站开发视频教程
  • 宁波网站制作出售爱南宁app下载官网最新版
  • 科技类公司名称大全常州网站关键词优化咨询
  • 共享ip服务器做网站如何把网站推广出
  • 网站开发标书范本免费模板下载网站推荐
  • 郑州品牌网站建设宿松县住房和城乡建设局网站
  • 电商网站开发与运营赣州爆炸事故
  • 牡丹区建设局网站黄骅贴吧最近发生的事
  • 手机一键建站北京公司网站建站
  • 做个简单网站大概多少钱广州联亨科技网站建设
  • 恺策网优 营销型网站建设品牌服务商在线html网站开发
  • 做seo要明白网站桂林生活网新闻
  • 网站建设供需武昌做网站哪家专业
  • 好看的电商网站模板网易对象存储wordpress
  • 上海工商网查询企业信息查询系统安卓优化大师app下载
  • 深圳网站快速备案亳州做网站
  • 个人网站如何建jsp做的网站源码
  • 竹子建站公司怎么在百度上创建自己的网页
  • 专门做恐怖电影网站电子商务网站建设 实验
  • 旅游网站案例遂宁网站建设公司哪家好
  • WordPress站群更新wordpress 图片命名吗
  • 网站建设最好的公司哪家好网站模板下载软件
  • 运输公司网站模板网站建设及使用
  • 哈尔滨cms模板建站网站建设天地心
  • 廊坊代运营公司广东网站se0优化公司
  • 西双版纳建设厅网站宁夏建网站报价
  • 网站优化分析软件手机端网站源码
  • 我想克隆个网站 怎么做网站 运营工作如何做
  • 承德网站制作公司哪家好如何选择邯郸网站建设
  • 网络分析的应用案例广东网络seo推广平台