GitHub user marlonssilva added a comment to the discussion: superset_app_root 
doesn't work in superset 4.1.2 with nginx

how I did,


npm create vite@latest superset-redirect -- --template react 

cd superset-redirect 

npm install 


npm run build

npm install react-router-dom




vite.config.js
______________________________________________________________________________________________________
export default defineConfig({
   base: '/app/', --> need to add base path to be used as a root proxy in ngnix
   
  plugins: [react()],


})
______________________________________________________________________________________________________

/src/app.jsx
______________________________________________________________________________________________________
import { useEffect } from 'react';

export default function App() {
  useEffect(() => {
    const hash = window.location.hash;

    if (hash === '#/' || hash === '' || hash === '/') {
      //Here it does not redirect, it just changes the hash to keep the URL
      window.location.hash = '#/';
    }
  }, []);

  return (
    <div>
      <iframe

        seamless
        src="http://localhost:8088/";
        style={{ width: '100vw', height: '100vh', border: 'none' }}
        title="Superset"
      />
    </div>
  );
}

______________________________________________________________________________________________________

npm run dev    or 
npm run prod




______________________________________________________________________________________________________
______________________________________________________________________________________________________

in TALISMAN_CONFIG necessary to allow



add "frame-ancestors": ["'self'", "http://localhost:{port react}", 
"http://localhost";] 


______________________________________________________________________________________________________
______________________________________________________________________________________________________

no ngnix


location /app/ {
    
    proxy_pass http://localhost:{port react}/app/; --> will call react not 
superset
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

}

GitHub link: 
https://github.com/apache/superset/discussions/33229#discussioncomment-13855155

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to