当前位置:网站首页>Crawling data encounters single point login problem
Crawling data encounters single point login problem
2022-07-06 18:38:00 【Big folk song】
Crawling website data is , Find the same token At the same time, it is kept in domainA.cn and domainB.com Next , adopt selenium To achieve login free access to data , Summary of knowledge points to solve cross domain problem finding .
Browser cross domain problem understanding ?
The same-origin policy :
Three is the same : agreement , port , domain name
The purpose of formulating homology strategy :
Prevent request forgery : Front end interaction , Get the server token stored in token Next , If there is no homology strategy ,token It can be easily obtained by other molecules .
Three limitations of non homology :
Can't get the cookie、localstorage and indexedDB
Can't access non homologous pages DOM (iframe)
Can't send... To a non homologous address AJAX request or fetch request ( Can send , But the browser refused to accept the response )
How to solve cross domain problems :
- Server implementation CORS Interface understanding
The server interacts with the client ,http Add... To the request header ACCESS Start parameter to interact
A simple request : The actual request contains ACCESS parameter information
Pre inspection request : Before sending the actual request , Send a OPTION request , After passing the inspection , Send the actual request
The preview request with the certificate needs to be in the request header withCredentials
Set to true
For details, please refer to the link : Cross source resource sharing (CORS) - HTTP | MDN
- Use JavaScript Of src Properties are implemented without cross domain restrictions
Request header X-Requested-With What is the function of parameters ?
Can be judged ajax Request or other request . Server interpretation allows browsers to cross source servers , issue XMLHttpRequest request
Documents referenced in the article :
Cross source resource sharing (CORS) - HTTP | MDN
Thoroughly understand the cross domain of browser - Nuggets
Cross domain single sign on solution implementation - Nuggets
Different domain names pass JSONP Cross domain sharing cookie- Huang Yunxin's blog
边栏推荐
- DOM简要
- ORACLE进阶(四)表连接讲解
- Jerry is the custom background specified by the currently used dial enable [chapter]
- MySQL查询请求的执行过程——底层原理
- Xu Xiang's wife Ying Ying responded to the "stock review": she wrote it!
- TOP命令详解
- STM32+ENC28J60+UIP协议栈实现WEB服务器示例
- Stm32+hc05 serial port Bluetooth design simple Bluetooth speaker
- Rb157-asemi rectifier bridge RB157
- Stm32+esp8266+mqtt protocol connects onenet IOT platform
猜你喜欢
MySQL查询请求的执行过程——底层原理
On time and parameter selection of asemi rectifier bridge db207
Prophet模型的简介以及案例分析
小程序在产业互联网中的作用
Breadth first traversal of graph
Docker installation redis
Some understandings of tree LSTM and DGL code implementation
Top command details
Xu Xiang's wife Ying Ying responded to the "stock review": she wrote it!
There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed
随机推荐
There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed
[Matlab] Simulink 同一模块的输入输出的变量不能同名
Reproduce ThinkPHP 2 X Arbitrary Code Execution Vulnerability
44 colleges and universities were selected! Publicity of distributed intelligent computing project list
UFIDA OA vulnerability learning - ncfindweb directory traversal vulnerability
转载:基于深度学习的工业品组件缺陷检测技术
传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
2022-2024年CIFAR Azrieli全球学者名单公布,18位青年学者加入6个研究项目
首先看K一个难看的数字
Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages
D binding function
Self-supervised Heterogeneous Graph Neural Network with Co-contrastive Learning 论文阅读
AvL树的实现
巨杉数据库首批入选金融信创解决方案!
Excellent open source fonts for programmers
Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
文档编辑之markdown语法(typora)
Use cpolar to build a business website (1)
Cobra quick start - designed for command line programs
被疫情占据的上半年,你还好么?| 2022年中总结