当前位置:网站首页>JS跨域问题解决
JS跨域问题解决
2022-04-22 07:45:00 【漂泊的猎人】
JS跨域问题解决
1、jsonp方式请求获取
前端js请求携带函数名称,后端服务响应内容作为函数参数响应返回
2、后端服务配置跨域响应请求
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader(“Access-Control-Allow-Headers”, “*”);
response.setHeader(“Access-Control-Allow-Methods”, “POST, GET, OPTIONS, DELETE”);
3、nginx服务代理设置
location / {
add_header Access-Control-Allow-Origin http://www.domain1.com; #当前端只跨域不带cookie时,可为*
}
版权声明
本文为[漂泊的猎人]所创,转载请带上原文链接,感谢
https://blog.csdn.net/u010353018/article/details/117424381
边栏推荐
- 客户端与服务器通信项目4
- leaflet、cesium加载百度地图,加载自定义样式百度地图
- 226. Flip binary tree (easy)
- 129. Find the sum of numbers from root node to leaf node (medium)
- 第3关:节点状态检查、数据查看和更新
- redis 简单使用
- Realization of floor decomposition animation in cesium
- OSPF class IV, class V and class VII LSA details
- 235. Nearest common ancestor of binary search tree (easy)
- Introduction to smarttablayout
猜你喜欢

Action inattendue dans une instruction SQL

第3关:节点配额及其他命令

Matlab installation product selection, how to select the products to be installed

1315. Sum of nodes with even grandfather node value (medium)

leaflet、cesium加载百度地图,加载自定义样式百度地图

SQL 語句中 “意想不到” 的操作

el-input输入框输入无效,且Error in data(): “ReferenceError: el is not defined“

Level 1: create / delete nodes
![[Dahua cloud native] micro service chapter - service mode of five-star hotels](/img/fc/be18f39e4aa653efa8603ab63ff3f1.png)
[Dahua cloud native] micro service chapter - service mode of five-star hotels

Function pointers and pointer functions
随机推荐
微信小程序:TypeError: Cannot read property ‘mark’ of undefined
又来一个上三角数字三角形
oracle 数据库常识以及使用
猴子吃桃子问题(循环、递归)
cesium实现建筑物单体化(分栋分层)
Client server communication project 2
Realization of floor decomposition animation in cesium
Fluent listview loads more
CentOS 安装 MySQL
Teach you how to realize the pull-down refresh and pull-up load of recyclerview
Binary leading zero
第3关:节点状态检查、数据查看和更新
Cesium coordinate conversion: conversion between different coordinate systems
Matlab tip: to use 'xxx function', you must authorize, install and enable the following products: XXX toolbox
Shell 命令脚本
第2关:多态
Common sense and use of Oracle Database
PCIe学习-PCIe总线体系结构入门:事务层-数据链路层-物理层(八)
Machine learning notes - Mathematics in principal component analysis
Lambda 表达式