diff --git a/src/components/theme/View/View.jsx b/src/components/theme/View/View.jsx
index 0fb916922b..e9e148265d 100644
--- a/src/components/theme/View/View.jsx
+++ b/src/components/theme/View/View.jsx
@@ -206,6 +206,11 @@ class View extends Component {
if (this.props.error && this.props.error.code === 301) {
const redirect = flattenToAppURL(this.props.error.url).split('?')[0];
return ;
+ } else if (this.props.error && this.props.error.status === 302) {
+ const redirect = flattenToAppURL(
+ this.props.error.response.header.location,
+ ).split('?')[0];
+ return ;
} else if (this.props.error && !this.props.connectionRefused) {
let FoundView;
if (this.props.error.status === undefined) {
diff --git a/src/helpers/Api/Api.js b/src/helpers/Api/Api.js
index c91a667ea4..4a5c81d546 100644
--- a/src/helpers/Api/Api.js
+++ b/src/helpers/Api/Api.js
@@ -54,7 +54,7 @@ class Api {
) => {
let request;
let promise = new Promise((resolve, reject) => {
- request = superagent[method](formatUrl(path));
+ request = superagent[method](formatUrl(path)).redirects(0);
if (params) {
request.query(params);
diff --git a/src/helpers/Api/Api.plone.rest.test.js b/src/helpers/Api/Api.plone.rest.test.js
index 80e18682d1..81fa1104b2 100644
--- a/src/helpers/Api/Api.plone.rest.test.js
+++ b/src/helpers/Api/Api.plone.rest.test.js
@@ -3,12 +3,14 @@ import Api from './Api';
jest.mock('superagent', () => ({
get: jest.fn((url) => ({
- url,
- query: jest.fn(),
- set: jest.fn(),
- type: jest.fn(),
- send: jest.fn(),
- end: jest.fn(),
+ redirects: jest.fn(() => ({
+ url,
+ query: jest.fn(),
+ set: jest.fn(),
+ type: jest.fn(),
+ send: jest.fn(),
+ end: jest.fn(),
+ })),
})),
}));
diff --git a/src/helpers/Api/Api.test.js b/src/helpers/Api/Api.test.js
index c877f1724f..2cd2bcd6bb 100644
--- a/src/helpers/Api/Api.test.js
+++ b/src/helpers/Api/Api.test.js
@@ -9,12 +9,14 @@ import Api from './Api';
jest.mock('superagent', () => ({
get: jest.fn((url) => ({
- url,
- query: jest.fn(),
- set: jest.fn(),
- type: jest.fn(),
- send: jest.fn(),
- end: jest.fn(),
+ redirects: jest.fn(() => ({
+ url,
+ query: jest.fn(),
+ set: jest.fn(),
+ type: jest.fn(),
+ send: jest.fn(),
+ end: jest.fn(),
+ })),
})),
}));