当前位置:网站首页>解决uni-app 打包H5网站 下载图片问题
解决uni-app 打包H5网站 下载图片问题
2022-08-02 03:24:00 【auspi12341】
接收一个H5打包app的项目,其中分享图片和H5网站不同域, 使用A标签download来下载图片因为存在跨域问题是直接打开新窗口,而不是下载图片
解决方案:
使用nginx反向代理功能
location ^~ /static/rcode/
{
proxy_pass http://xxx.com/static/rcode/;
proxy_set_header Host xxx.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_fileFRUN9puK 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileFRUN9puK 1;
expires 12h;
}
if ( $static_fileFRUN9puK = 0 )
{
add_header Cache-Control no-cache;
}
}解决图片跨域问题,实现下载功能
边栏推荐
- [vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
- 函数提升和变量提升
- clock tick marks
- 1.8今日学习
- Source Insight 使用教程(2)——常用功能
- 微信小程序云开发之券码领取,怎么防止用户领取到相同的数据?
- 新工程加载YOLOV6的预训练权重问题
- js 中this指向
- Living to detect the Adaptive Normalized Representation Learning for GeneralizableFace Anti - Spoofing reading notes
- 暴力方法求解(leetcode14)查找字符串数组中的最大公共前缀
猜你喜欢
随机推荐
C语言 内联函数
阿里云服务器如何使用admin账户登录
每日五道面试题总结 22/7/23
js预编译 GO 和AO
5.19今日学习
Phospholipid-polyethylene glycol-azide, DSPE-PEG-Azide, DSPE-PEG-N3, MW: 5000
啃瓜记录又一天
利用 nucleo stm32 f767zi 进行USART+DMA+PWM输入模式 CUBE配置
相对路径和绝对路径
uniapp | 使用npm update更新后编译报错问题
每日五道面试题总结 22/7/20
Amazon sellers how to improve the conversion
【手把手带你学nRF52832/nRF52840 · (1)开发环境搭建】
ES6数组的扩展方法map、filter、reduce、fill和数组遍历for…in for…of arr.forEach
每天填坑,精卫填坑第二集,TX1 配置从固态启动,安装Pytorch
函数提升和变量提升
Living to detect the Adaptive Normalized Representation Learning for GeneralizableFace Anti - Spoofing reading notes
Small program van-cell line wrapping can be left-aligned
【 application 】 life many years of operations, what turned scored 12 k + annual bonus salary?
解决5+APP真机测试无法访问后台(同局域网)
![微信小程序开发视频加载:[渲染层网络层错误] Failed to load media](/img/24/e12a1312aee28a43428b2ae0bfbe00.png)








