fix: remove Gatsby proxy (#37364)
Direct ajax calls to the server directly, rather than a proxy to reduce redirects while still allowing the server to be used in development.pull/37363/head^2
parent
e08ed1ef80
commit
4896e45eea
|
@ -6,8 +6,6 @@ const {
|
||||||
localeChallengesRootDir
|
localeChallengesRootDir
|
||||||
} = require('./utils/buildChallenges');
|
} = require('./utils/buildChallenges');
|
||||||
|
|
||||||
const { API_PROXY: proxyUrl = 'http://localhost:3000' } = process.env;
|
|
||||||
|
|
||||||
const curriculumIntroRoot = path.resolve(__dirname, './src/pages');
|
const curriculumIntroRoot = path.resolve(__dirname, './src/pages');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -15,10 +13,6 @@ module.exports = {
|
||||||
title: 'freeCodeCamp',
|
title: 'freeCodeCamp',
|
||||||
siteUrl: 'https://www.freecodecamp.org'
|
siteUrl: 'https://www.freecodecamp.org'
|
||||||
},
|
},
|
||||||
proxy: {
|
|
||||||
prefix: '/internal',
|
|
||||||
url: proxyUrl
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
'gatsby-plugin-react-helmet',
|
'gatsby-plugin-react-helmet',
|
||||||
'gatsby-plugin-postcss',
|
'gatsby-plugin-postcss',
|
||||||
|
|
|
@ -124,7 +124,7 @@ class DonateForm extends Component {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const chargeStripePath = isSignedIn
|
const chargeStripePath = isSignedIn
|
||||||
? '/internal/donate/charge-stripe'
|
? `${apiLocation}/internal/donate/charge-stripe`
|
||||||
: `${apiLocation}/unauthenticated/donate/charge-stripe`;
|
: `${apiLocation}/unauthenticated/donate/charge-stripe`;
|
||||||
return postJSON$(chargeStripePath, {
|
return postJSON$(chargeStripePath, {
|
||||||
token,
|
token,
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
import { apiLocation } from '../../config/env.json';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const base = '/internal';
|
const base = apiLocation + '/internal';
|
||||||
|
|
||||||
axios.defaults.withCredentials = true;
|
axios.defaults.withCredentials = true;
|
||||||
|
|
||||||
function get(path) {
|
function get(path) {
|
||||||
|
|
Loading…
Reference in New Issue