近期在做将高德地图替换为天地图时遇到了这个问题,原因是https由于安全协议禁止了http的请求

http://api.tianditu.gov.cn/api?v=4.0&tk=XXXXXXX

可以通过以下方法解决

1.在.html中添加

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
2.在APP.vue中添加
const meta = document.createElement('meta')
meta.httpEquiv = 'Content-Security-Policy'
meta.content = 'upgrade-insecure-requests'
document.head.appendChild(meta)
原理:
这是一个 HTML 元标签,用于设置内容安全策略(Content Security Policy,CSP)。
“upgrade-insecure-requests” 指令的含义是将所有通过 HTTP 发起的请求自动升级为 HTTPS 请求。这有助于提高网站的安全性,确保数据在传输过程中被加密,防止中间人攻击和数据泄露等安全风险。例如,当页面中存在指向 HTTP 资源(如图片、脚本、样式表等)的链接或请求时,浏览器会自动将这些请求转换为 HTTPS 请求,前提是目标服务器支持 HTTPS。如果服务器不支持 HTTPS,请求可能会失败。此策略可促使网站逐步向全 HTTPS 环境过渡,提升整体安全性和用户隐私保护水平。

This request has been blocked; the content must be served over HTTPS.此请求已被阻止;内容必须通过HTTPS提供的更多相关文章

  1. Mixed Content: xxx This request has been blocked; the content must be served over HTTPS.

    在升级https的过程中,出现如下问题: Mixed Content: The page at 'https://www.xxx.com/denglu.html' was loaded over HT ...

  2. https下 http的会被阻塞 This request has been blocked; the content must be served over HTTPS.

    如何在HTTPS 网页中引入HTTP资源: Mixed Content? https://segmentfault.com/q/1010000005872734/a-1020000005874533 ...

  3. 【Https异常】This request has been blocked; the content must be served over HTTPS

    一.问题出现场景 项目从http升级到https后,jsp页面存在发送http请求的情况下就会出现该异常.因为HTTPS 是 HTTP over Secure Socket Layer,以安全为目标的 ...

  4. 在普通网页显示正常,加Https报This request has been blocked; the content must be served over HTTPS.,https网站加载http资源时,http资源被block

    解决办法 :在html头加<meta http-equiv="Content-Security-Policy" content="upgrade-insecure- ...

  5. This request has been blocked; the content must be served over HTTPS.处理方案

    在页面head标签中加入 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure- ...

  6. 网页中嵌入百度地图报错:The request has been blocked,the content must served over Https

    网页中嵌入百度地图 1.进入百度地图开发平台:http://lbsyun.baidu.com/index.php?title=jspopular 2.获取密钥:http://lbsyun.baidu. ...

  7. Cross-origin plugin content from must have a visible size larger than 400 x 300 pixels, or it will be blocked. Invisible content is always blocked.

    Cross-origin plugin content from  must have a visible size larger than 400 x 300 pixels, or it will ...

  8. 大概看了一天python request源码。写下python requests库发送 get,post请求大概过程。

    python requests库发送请求时,比如get请求,大概过程. 一.发起get请求过程:调用requests.get(url,**kwargs)-->request('get', url ...

  9. python 抓取request信息,各种cookie,user-agent类的信息,只调试到http可以抓取,https貌似不行。

    import pcap # 安装的是pypcap,本博客有安装方法,不过也比较乱,试试吧.import dpktimport socketimport datetime def sniffer(str ...

  10. Restful Fast Request 添加前置脚本,实现不同环境免设置token 直接请求

    idea安装Restful Fast Request插件后,进行如下设置,并打开 项目全局参数 对话框 进入前置脚本 tab 编写如下groovy脚本代码(插件脚本语言默认支持groovy,该语言被称 ...

随机推荐

  1. 反DDD模式之“复用”

    本文书接上回<反DDD模式之关系型数据库>,关注公众号(老肖想当外语大佬)获取信息: 最新文章更新: DDD框架源码(.NET.Java双平台): 加群畅聊,建模分析.技术实现交流: 视频 ...

  2. 使用ftrace查找Kernel启动阶段的延时原因

    查找Kernel启动阶段的延时原因 1.确保内核配置了如下选项 CONFIG_FTRACE: "Tracers" CONFIG_FUNCTION_TRACER: "Ker ...

  3. FirewallD is not running 原因与解决方法

    解决方法关于linux系统防火墙: centos5.centos6.redhat6系统自带的是iptables防火墙.centos7.redhat7自带firewall防火墙.ubuntu系统使用的是 ...

  4. kotlin更多语言结构——>解构声明

    解构声明 有时把一个对象 解构 成很多变量会很方便,例如: val (name, age) = person 这种语法称为 解构声明 .一个解构声明同时创建多个变量.我们已经声明了两个新变量:name ...

  5. java工具篇-IDEA

    java的开发离不开好的开发工具,这就需要了解集成开发工具idea 背景黑白风格 设置方法File–>settings–>Appearance & Behavior–>App ...

  6. python多线程应用-批量下载拉勾网课程

    import concurrent import os import re import time from collections.abc import Iterable from Crypto.C ...

  7. charles+Nox

    Charles设置 一.添加SSL证书 ![1](C:\Users\Lifree\Desktop\MD\C\charles zhengshu\1.png) ![2](C:\Users\Lifree\D ...

  8. NDT算法(深蓝学院)

  9. AMCL 原理解读

    AMCL(adaptive Monte Carlo Localization)自适应蒙特卡洛定位,A也可以理解为augmented,,源于MCL算法的一种增强,是机器人在二维移动过程中概率定位系统,采 ...

  10. C# 动态调用webservice代码

    /// <summary> /// 动态调用WebService /// </summary> /// <param name="url">UR ...