GitHub user dosubot[bot] added a comment to the discussion: superset_app_root 
doesn't work in superset 4.1.2 with nginx

<!-- Answer -->
To resolve the 404 error when accessing Apache Superset 4.1.2 with a custom 
application root '/analytics' in a Kubernetes environment using Nginx as a 
proxy, ensure that the `SUPERSET_APP_ROOT` is correctly configured. You can do 
this by setting the `SUPERSET_APP_ROOT` environment variable to '/analytics'. 
Additionally, ensure that your Nginx configuration correctly forwards requests 
to the Superset application with the '/analytics' prefix.

Here is how you can set the `SUPERSET_APP_ROOT`:

```sh
FLASK_APP="superset:create_app(superset_app_root='/analytics')"
```

Or, if you are using Docker:

```sh
SUPERSET_APP_ROOT='/analytics'
```

Make sure your Nginx configuration is set to handle the '/analytics' path 
correctly, forwarding it to the Superset service. This might involve setting up 
a location block in your Nginx configuration like this:

```nginx
location /analytics/ {
    proxy_pass http://your-superset-service/analytics/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}
```

Ensure that the Nginx configuration and the Superset application root are 
consistent with each other 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</sup>.

Additionally, when using a reverse proxy with a custom application root, you 
should enable the `ENABLE_PROXY_FIX` setting in the Superset configuration to 
ensure that all X-Forwarded headers are used correctly. This is important when 
Superset is behind a reverse proxy. You can do this by setting:

```py
ENABLE_PROXY_FIX = True
```

Furthermore, ensure that the `X-Script-Name` header is set correctly in your 
Nginx configuration to match the prefix 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/config.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*

---
<sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/e614b171-6791-4c70-b4f5-7618bf46ffe7?feedback_type=other)</sup>


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

----
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