fix(server,client): CORS is a real nightmare
This commit is contained in:
committed by
mrugesh
parent
de5e88942f
commit
56d78a1119
@ -1,6 +1,9 @@
|
|||||||
|
import { homeLocation } from '../../../config/env';
|
||||||
|
|
||||||
export default function constantHeaders() {
|
export default function constantHeaders() {
|
||||||
return function(req, res, next) {
|
return function(req, res, next) {
|
||||||
res.header('Access-Control-Allow-Origin', '*');
|
res.header('Access-Control-Allow-Origin', homeLocation);
|
||||||
|
res.header('Access-Control-Allow-Credentials', true);
|
||||||
res.header(
|
res.header(
|
||||||
'Access-Control-Allow-Headers',
|
'Access-Control-Allow-Headers',
|
||||||
'Origin, X-Requested-With, Content-Type, Accept'
|
'Origin, X-Requested-With, Content-Type, Accept'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const base = '/internal';
|
const base = '/internal';
|
||||||
|
axios.defaults.withCredentials = true;
|
||||||
|
|
||||||
function get(path) {
|
function get(path) {
|
||||||
return axios.get(`${base}${path}`);
|
return axios.get(`${base}${path}`);
|
||||||
|
Reference in New Issue
Block a user