当前位置:网站首页>2020-09-17 gateway业务流程 两个任务:referer认证和非商品模板化
2020-09-17 gateway业务流程 两个任务:referer认证和非商品模板化
2022-06-29 09:10:00 【qqq2018】
gateway主要功能:
外部请求->1.gw解析请求->2.向ad-server发送请求->3.解析ad-server发来的应答->4.向外部发应答
在外部看,就是给gateway发送request,然后gateway返回一个response。
//外部给gateway发送request,然后gateway返回一个response。
bool BidRequestHandler::ProcessBidRequest(const shared_ptr<HttpRequest> request, shared_ptr<HttpResponse> response) {
//这四个步骤在代码中的位置
// 1.
shared_ptr<BidRequest> bid_request = handler->ParseBidRequest();
// 2.3.
bool ret = handler->CallServices(request, bid_request, ads_req, ads_resp, fill_data_arr, err_msg);
// 2.
err_msg = PrepareCallAds(request, bid_request, ads_req);
// 3.
ads_resp = GetAdsResponse(ads_req);
// 4.
if (handler->WriteBidResponse(fill_data_arr, response))
实现两个小功能:
1.非商品(比如店铺之类的)模板化。设置一些统一的模板来给前端用,替代以前每次前端定义一个样式,后端就跟着判断后再处理。
实现方法:设置几种模板,提供给前端选择。
2.添加referer认证并落日志。
目的:控制一些网页,让这些网页不要出广告。
实现方法:从HTTP的Headers中取出 Reference(记录了父页面的url),在黑名单词表中有就给干掉直接返回,不显示广告。把referer落日志->思南(代码中原来叫指南针)
http的request请求的header中,referer记录了发起请求的页面(就是这个请求来自哪里)。
一个例子:从百度的主页搜索一个内容的request头:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Cookie: ……
Host: www.baidu.com
Referer: https://www.baidu.com/
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Upgrade-Insecure-Requests: 1
User-Agent: ……
可以看到referer是百度主页,说明这个请求是百度从百度主页来的。
边栏推荐
- 证券账号开户安全吗?是靠谱的吗?
- A comparison of methods for fully automatic segmentation of tumors and involved nodes in PET/CT of h
- LeetCode刷题——泰波那契数列
- Data warehouse: layered architecture of Finance / banking
- Idea debugging fails, reporting jdwp no transports initialized, jvmtierror=agent_ ERROR_ TRANSPORT_ LOAD(196)
- Data governance: the solution of data governance in the data Arena
- 云管理平台:OpenStack架构设计及详细解读
- 转载 :判断对象是否具有属性的5种方法
- c#判断数组是否包含另一个数组的任何项
- Data visualization: the four quadrants of data visualization teach you to correctly apply icons
猜你喜欢

1.4 机器学习方法之回归问题

Gross Tumor Volume Segmentation for Head and Neck Cancer Radiotherapy using Deep Dense Multi-modalit

数据可视化:数据可视化四象限,教你正确应用图标

Introduction to Chang'an chain data storage and construction of MySQL storage environment

Closed training (25) basic web security

A comparison of methods for fully automatic segmentation of tumors and involved nodes in PET/CT of h

In the future of Business Intelligence BI, how do you view the ai+bi model?

Lc236. nearest common ancestor of binary tree

数据治理:数据标准管理(第三篇)

The principle of session and cookie
随机推荐
Construction and use of Changan chain go language smart contract environment
[technology development] development and design of alcohol tester solution
Uber 前安全主管面临欺诈指控,曾隐瞒数据泄露事件
Reading notes on how to connect the network - Web server request and response (V)
Go deep into RC, RS, daemonset and statefulset (VII)
Reading notes on how to connect the network - Web server request and response (IV)
Data governance: the solution of data governance in the data Arena
Matlab tips (21) matrix analysis -- partial least squares regression
IDEA调试失败,报JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_LOAD(196)
数据可视化:数据可视化四象限,教你正确应用图标
1424. diagonal traversal II
CROSSFORMER: A VERSATILE VISION TRANSFORMER BASED ON CROSS-SCALE ATTENTION
Print service IP setting scheme
KiCad学习笔记--快捷键
linux下centos7中mysql5.7安装教程
Mysql5.7 installation tutorial in centos7 under Linux
Five heart charity matchmaker team
Making of simple addition calculator based on pyqt5 and QT Designer
A comparison of methods for fully automatic segmentation of tumors and involved nodes in PET/CT of h
用户级线程和内核级线程