Skip to content

Commit

Permalink
CORS proxy now seems to require x-requested-with header
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Jan 14, 2025
1 parent a43dc32 commit 14df6c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 6 additions & 1 deletion apps/model_catalog/src/Introduction.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ class Introduction extends React.Component {

componentDidMount() {
this.mounted = true;
const headers = {
//'origin: ?,
'x-requested-with': 'XMLHttpRequest',
};
fetch(
corsProxy +
"https://object.cscs.ch/v1/AUTH_c0a333ecf7c045809321ce9d9ecdfdea/VF_paper_demo/vf_stats/models_stats.json"
"https://object.cscs.ch/v1/AUTH_c0a333ecf7c045809321ce9d9ecdfdea/VF_paper_demo/vf_stats/models_stats.json",
{ headers }
)
.then((response) => response.json())
.then((jsonData) => {
Expand Down
1 change: 1 addition & 0 deletions apps/model_catalog/src/ResultRelatedFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ResultFile extends React.Component {
if (this.state.url.includes("drive.ebrains.eu")) {
config["headers"] = {
Authorization: "Bearer " + this.state.auth.token,
'x-requested-with': 'XMLHttpRequest',
};
const url_parts = this.state.url.match(".*/lib/(.*)/file(/.*)");
query_url =
Expand Down
4 changes: 1 addition & 3 deletions apps/model_catalog/src/globals-staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export const queryValid = [
export const ADMIN_PROJECT_ID = "model-validation";

// Since Collaboratory v2 storage and CSCS storage gives CORS related issues
export const corsProxy = "https://corsproxy.hbpneuromorphic.eu/";
// previously used https://corsproxy-sa.herokuapp.com/, https://cors-anywhere.herokuapp.com/ - but now has request limits
// other options: https://cors-clear.herokuapp.com/, https://cors-fixer.herokuapp.com/, https://cors-handler.herokuapp.com/
export const corsProxy = "https://corsproxy.apps.tc.humanbrainproject.eu/";

export const updateHash = (value) => {
window.location.hash = value;
Expand Down
3 changes: 1 addition & 2 deletions apps/model_catalog/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ export const queryValid = [
export const ADMIN_PROJECT_ID = "model-validation";

// Since Collaboratory v2 storage and CSCS storage gives CORS related issues
export const corsProxy = "https://corsproxy.hbpneuromorphic.eu/";
//export const corsProxy = "https://corsproxy.apps.tc.humanbrainproject.eu/";
export const corsProxy = "https://corsproxy.apps.tc.humanbrainproject.eu/";

export const updateHash = (value) => {
window.location.hash = value;
Expand Down

0 comments on commit 14df6c2

Please sign in to comment.