当前位置:网站首页>解决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;
}
}
解决图片跨域问题,实现下载功能
边栏推荐
- 微信小程序怎么批量生成带参数的小程序码?
- Living to detect the Adaptive Normalized Representation Learning for GeneralizableFace Anti - Spoofing reading notes
- 微信小程序九宫格抽奖和转盘抽奖的实现
- 微信小程序云开发如何将页面生成为pdf?
- 客户评分控件
- __dirname
- 骨架效果 之高级渐变,适用图片等待时
- DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine supply, MW: 5000
- COCO数据集训练TPH-YoloV5
- canvas--饼状图
猜你喜欢
随机推荐
ES6迭代器解释举例
Common methods of js array deduplication
[vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
1.6一些今日学习
面试总结 22/7/25 面试中的重点
1.13 学习JS
mysql阶段总结
骨架效果 之高级渐变,适用图片等待时
Questions about your resume
啃瓜记录又一天
猴子选大王
微信小程序怎么批量生成带参数的小程序码?
猴子选大王(约瑟环问题)
你的本地创建的项目库还在手动创建远端代码仓库再推送吗,该用它了
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine supply, MW: 5000
debian 10 nat and routing forwarding
三月底啦啦
点名系统和数组元素为对象的排序求最大值和最小值
C语言 void和void *(无类型指针)
FreeRTOS内核详解(1) —— 临界段保护原理