rsbhatti opened a new pull request, #34407:
URL: https://github.com/apache/superset/pull/34407

   Description
   This PR fixes [#33304](https://github.com/apache/superset/issues/33304) by 
adding support for Superset deployments behind a URL prefix (e.g., when 
APPLICATION_ROOT or SUPERSET_APP_ROOT is set) in both the OpenAPI specification 
and the Swagger UI.
   
   Motivation
   Currently, when Superset is deployed behind a reverse proxy with a URL 
prefix, the Swagger UI breaks because it does not correctly generate the 
OpenAPI server URLs or locate the spec file using the prefix. This makes it 
impossible to use the Swagger-based API documentation in such environments.
   
   Changes
   Introduced a new SupersetOpenApi class to expose OpenAPI specs per version 
at /api/<version>/_openapi, dynamically resolving and registering API views.
   
   Introduced a new SupsersetSwaggerView to render the Swagger UI HTML page 
with the correct openapi_uri, taking APPLICATION_ROOT into account.
   
   Reused the existing Swagger HTML template (swagger.html), only modifying how 
it receives the OpenAPI URL.
   
   Provided fallbacks to default behavior for backward compatibility (no prefix 
set).
   
   Ensured compatibility with both prefixed and non-prefixed deployments.
   
   How to Test
   Set APPLICATION_ROOT = "/myprefix"
   
   Visit /myprefix/swagger/v1 and confirm:
   
   Swagger UI loads correctly
   
   OpenAPI spec is loaded from /myprefix/api/v1/_openapi
   
   "Try It Out" works for all endpoints
   
   
   Related Issues
   Fixes: [#33304](https://github.com/apache/superset/issues/33304)


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to