FrancescoCastaldi commented on issue #45638:
URL: https://github.com/apache/superset/issues/45638#issuecomment-6524018890

   ### Root Cause Analysis & Solution
   
   In 
`superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.tsx`,
 thumbnail requests are made using native `fetch`:
   ```typescript
   fetch(src, { credentials: 'same-origin' })
   ```
   When Superset is hosted under a subpath behind a reverse proxy (e.g. 
`SUPERSET_APP_ROOT = "/analytics"`), relative URLs such as 
`"/api/v1/chart/1/thumbnail/..."` do not include the application root prefix, 
resulting in HTTP 404 responses for card thumbnails.
   
   #### Solution
   Prepend the configured application root by composing the endpoint URL 
through `SupersetClient`:
   ```typescript
   import { SupersetClient } from '@superset-ui/core';
   
   const url = src.startsWith('http') ? src : SupersetClient.getUrl({ endpoint: 
src });
   fetch(url, { credentials: 'same-origin' })
   ```
   
   Verified with unit tests in `ImageLoader.test.tsx` and committed to branch 
`fix/community-unanswered-issues` (commit `2d8a057b7b6`) at 
https://github.com/FrancescoCastaldi/superset/tree/fix/community-unanswered-issues.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to