Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageErrorHandler doesnt redirect to mentioned path if microfrontend fails with "X-frame-options:sameorigin" error #1308

Closed
mayankgupta0510 opened this issue Apr 29, 2020 · 1 comment · Fixed by #1310
Assignees
Labels
documentation documentation tasks
Milestone

Comments

@mayankgupta0510
Copy link

Hi,
I wanted to redirect to specific page if microfrontend fails with any error (but specifically I am looking for X-Frame-options error).
so in my example : if I navigate to "/extension" then it should load the microfrontend and ifmicrofront has X-frame-options : sameorigin then it should redirect to my specified path i.e.
"/extension.html" page
let me know if I have missed anything here.

below is my Luigi-config :

Luigi.setConfig({
navigation: {
contextSwitcher : {
defaultLabel: 'Select Subdomain',
parentNodePath: '/extension', // absolute path
lazyloadOptions: true, // load options on click instead on page load
options: () =>
[...Array(2).keys()]
.filter(n => n !== 0)
.map(n => ({
label: 'i077549-dev', // (i.e mapping between what the user sees and what is taken to replace the dynamic part for the dynamic node)
pathValue: '?~subdomain=i077549-dev' // will be used to replace dynamic part
}))
},

    nodes: [{
        pathSegment: 'home',
        hideFromNav: true,
        hideSideNav: true,
        viewUrl: '/newhome.html',
        loadingIndicator: {
        enabled: false,
        pageErrorHandler: {
            timeout: 3,
            errorFn: () => _utils.setWindowLocationHref('extension')
        }
      }
    },{
      pathSegment: 'extension',
      hideFromNav: true, 
      hideSideNav: true,
      loadingIndicator: {
        enabled: false
      },
    onNodeActivation : function(){
        console.log("Node Activated");
    },
      pageErrorHandler: {
            timeout: 3,
            redirectPath: '/extension.html#subdomain={nodeParams.subdomain}'
      },
      viewUrl: 'https://sap-cloud-platform-home-i077549-dev-development-saptest.cfapps.sap.hana.ondemand.com/'
    }],
  appSwitcher :{
    showMainAppEntry: true,
    items: [
      {
        title: 'Extension suite',
        link: '/extension'
      },
    ]
  }
        
},
routing: {
    useHashRouting: false,
    nodeParamPrefix: '~'
},
settings: {
    responsiveNavigation: 'Fiori3',
    header: {
        title: 'SAP Cloud Platform Home'
    },
    customSandboxRules: ['allow-top-navigation'],
    iframeCreationInterceptor: (iframe, viewGroup, navigationNode, microFrontendType) => {
        if (microFrontendType !== 'modal')
            iframe.allowFullscreen = true;
        }
}

I have an microfrontend : "https://sap-cloud-platform-home-i077549-dev-development-saptest.cfapps.sap.hana.ondemand.com/’"

@marynaKhromova marynaKhromova added this to the Sprint 10 milestone Apr 29, 2020
@marynaKhromova
Copy link
Contributor

We should add to the documentation that the PageErrorHandler works only if loading indicator is not disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants