diff --git a/packages/roc-package-web-app-react/src/app/server/reactRouter.js b/packages/roc-package-web-app-react/src/app/server/reactRouter.js index 0cdaf64..fd6c952 100755 --- a/packages/roc-package-web-app-react/src/app/server/reactRouter.js +++ b/packages/roc-package-web-app-react/src/app/server/reactRouter.js @@ -76,6 +76,9 @@ export default function reactRouter({ }); if (redirect) { + if (rocConfig.runtime.redirectStatusCode) { + this.status = rocConfig.runtime.redirectStatusCode; + } this.redirect(redirect); } else { this.status = status; diff --git a/packages/roc-package-web-app-react/src/config/roc.config.js b/packages/roc-package-web-app-react/src/config/roc.config.js index ef0cadd..fdebb4b 100644 --- a/packages/roc-package-web-app-react/src/config/roc.config.js +++ b/packages/roc-package-web-app-react/src/config/roc.config.js @@ -26,6 +26,7 @@ export default { style: [], }, ssr: true, + redirectStatusCode: 302, template: { path: undefined, name: 'main.html', diff --git a/packages/roc-package-web-app-react/src/config/roc.config.meta.js b/packages/roc-package-web-app-react/src/config/roc.config.meta.js index 64932b1..579af21 100644 --- a/packages/roc-package-web-app-react/src/config/roc.config.meta.js +++ b/packages/roc-package-web-app-react/src/config/roc.config.meta.js @@ -1,4 +1,15 @@ -import { isString, isBoolean, isPath, isArray, isObject, notEmpty, required, oneOf, isFunction } from 'roc/validators'; +import { + isString, + isBoolean, + isPath, + isArray, + isObject, + notEmpty, + required, + oneOf, + isFunction, + isInteger, +} from 'roc/validators'; export default { settings: { @@ -59,6 +70,10 @@ export default { description: 'If server side rendering should be enabled.', validator: required(isBoolean), }, + redirectStatusCode: { + description: 'Status code for redirects.', + validator: required(isInteger), + }, template: { path: { description: 'A directory, or array of directories, where the template for the application ' +