1、前言
在前段时间我需要在一个https的网站中注入我自己的脚本进行自动填充表单的功能,使用的是JQ的$.post函数进行http请求,但是执行该函数请求后报错如下:
Mixed Content: The page at ‘https://v2020.ft.cntaiping.com:8443/vpn/index.html‘ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://192.168.123.79/getKey‘. This request has been blocked; the content must be served over HTTPS.
意思是说当前访问的网站是一个https的网站,发送的请求已被锁定,发送的请求必须是https。那么我们就需要模拟一个https请求来达到我们的目的,方法有很多,这里我们使用nginx模拟一个https代理到我们http的真实请求也可以做到。