当前位置: 首页 > 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/544323/

相关文章:

  • 嘉兴建设教育网站培训中心网站wordpress有哪些弹窗插件
  • 石家庄网站seo外包无锡 做网站
  • 江西中慧城乡建设开发公司网站修复WordPress图片上传错误
  • 冠县网站设计做网站优化找谁
  • 网站的建设公司哪个好推广线上渠道
  • 网站建设方向论文提纲安徽鑫华建设有限公司网站
  • 哪个网站上门做护肤优秀建筑案例分析
  • 建立网站ftp刷排名seo软件
  • 网站pv是什么app开发入门基础教程
  • 开发网站的可行性the7企业中 英文wordpress模板
  • 晋城网站设计重庆小程序商城开发
  • 找人做网站被骗能立案吗阿里云专有网络做网站
  • 做别人一摸一样的网站犯法吗买一个网站多少钱
  • 网站建设介绍书网站转换率
  • 云浮各类免费建站商业街网站建设方案
  • 注册网站怎么注册不了网站诊断示例
  • 打电话沟通做网站美食网页模板免费下载
  • 网站可以做库存吗表白网页在线生成网站
  • wordpress全站301网络设计项目
  • 新建网站二级网页怎么做手机建行网站
  • 手机编辑WordPress博客唐山seo推广公司
  • 网站建设祥云平台高明网站设计案例
  • 做网站比较大的公司黑客入侵网站怎么做
  • 汕头网站建设哪里找网站建设找哪家好
  • 怎么做公司的宣传网站免费优化
  • 网站数据库模板下载中牟网络推广公司
  • 营销型网站有什么特点域名解析错误无法上网
  • 手机网站可以做英文版本吗惠州网络科技有限公司
  • 温州专业手机网站制作多少钱wordpress类似头条主题
  • 怎么做一个论坛网站wordpress 注册邮箱验证失败