wqbbs911 opened a new issue, #33228:
URL: https://github.com/apache/superset/issues/33228

   ### Bug description
   
   hi, i need to prefix superset app in k8s cluster.
   so i installed superset 4.1.2-py311 in K8S with official helm chart  
superset/superset:0.14.2 and tried to visit it via proxy nginx , but it doesn't 
work. the steps are:
   1. According to official document 
https://superset.apache.org/docs/configuration/configuring-superset/#configuring-the-application-root
 , added below env in superset_config.py via  alues-orig.yaml configOverrides 
field:
   ```
   SUPERSET_APP_ROOT= '/analytics'
   ENABLE_PROXY_FIX = True
   STATIC_ASSETS_PREFIX = '/analytics'
   ```
   2.  configure nginx, (BTW, my nginx server not in k8s, but the network if 
reachable,  it able to visit superset pod ip )
   ```
   location /analytics/ {
       proxy_pass         http://pod_ip:8080/;
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Script-Name /analytics;
   }
   ``` 
   3.  after deployed , try to visit it via https://servername/analytics, it 
will redirect to https://servername/superset/welcome/ and then got 404
   
   
![Image](https://github.com/user-attachments/assets/ff3147a2-46c7-498e-aa39-c1e353df86eb)
   
   4. i checked env and superset_config.py in pod, seems no problem:
   ```
   root@superset-5f44bc7bf6-gf2zx:/app# env
   REDIS_DB=1
   KUBERNETES_SERVICE_PORT_HTTPS=443
   
PYTHON_SHA256=2a9920c7a0cd236de33644ed980a13cbbc21058bfdc528febb6081575ed73be3
   KUBERNETES_SERVICE_PORT=443
   HOSTNAME=superset-5f44bc7bf6-gf2zx
   PYTHON_VERSION=3.11.11
   SUPERSET_REDIS_MASTER_PORT_6379_TCP_ADDR=10.11.254.79
   REDIS_HOST=superset-redis-headless
   REDIS_USER=
   SUPERSET_SERVICE_PORT=8080
   SUPERSET_REDIS_MASTER_PORT_6379_TCP_PORT=6379
   PWD=/app
   SUPERSET_REDIS_MASTER_PORT_6379_TCP_PROTO=tcp
   REDIS_PROTO=redis
   SUPERSET_SERVICE_PORT_HTTP=8080
   DB_PORT=5432
   DB_USER=superset
   HOME=/root
   LANG=C.UTF-8
   KUBERNETES_PORT_443_TCP=tcp://10.11.252.1:443
   GPG_KEY=A035C8C19219BA821ECEA86B64E628F8D684696D
   SUPERSET_HOME=/app/superset_home
   SUPERSET_REDIS_MASTER_SERVICE_PORT=6379
   SUPERSET_SERVICE_HOST=10.11.254.75
   SUPERSET_PORT_8080_TCP=tcp://10.11.254.75:8080
   REDIS_CELERY_DB=0
   SUPERSET_REDIS_MASTER_PORT=tcp://10.11.254.79:6379
   PYTHONPATH=/app/pythonpath
   TERM=xterm
   DB_HOST=superset-postgresql
   SUPERSET_PORT_8080_TCP_PORT=8080
   FLASK_APP=superset.app:create_app()
   SUPERSET_PORT_8080_TCP_ADDR=10.11.254.75
   SHLVL=1
   KUBERNETES_PORT_443_TCP_PROTO=tcp
   SUPERSET_PORT_8080_TCP_PROTO=tcp
   KUBERNETES_PORT_443_TCP_ADDR=10.11.252.1
   REDIS_PORT=6379
   DB_NAME=superset
   KUBERNETES_SERVICE_HOST=10.11.252.1
   LC_ALL=C.UTF-8
   KUBERNETES_PORT=tcp://10.11.252.1:443
   KUBERNETES_PORT_443_TCP_PORT=443
   
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   SUPERSET_PORT=8080
   SUPERSET_APP_ROOT=/analytics
   SUPERSET_REDIS_MASTER_SERVICE_HOST=10.11.254.79
   DB_PASS=superset
   SUPERSET_REDIS_MASTER_SERVICE_PORT_TCP_REDIS=6379
   SUPERSET_REDIS_MASTER_PORT_6379_TCP=tcp://10.11.254.79:6379
   SUPERSET_ENV=production
   _=/usr/bin/env
   root@superset-5f44bc7bf6-gf2zx:/app#
   ```
   part of my custom setting in superset_config.py:
   ```
   ...
   ...
   # Overrides
   # my_override
   WTF_CSRF_ENABLED = False
   DEFAULT_FEATURE_FLAGS = {
     "ENABLE_TEMPLATE_PROCESSING": True
     }
   ENABLE_CORS = True
   CORS_ORIGINS = ["*"]
   CORS_HEADERS = "*"
   CORS_SUPPORTS_CREDENTIALS = True
   APPLICATION_ROOT = '/analytics'
   STATIC_ASSETS_PREFIX = '/analytics'
   SUPERSET_APP_ROOT= '/analytics'
   ENABLE_PROXY_FIX = True
   LOG_LEVEL = "DEBUG"
   ...
   ...
   ```
   5. checkk logs
   nginx log:
   
   
![Image](https://github.com/user-attachments/assets/45fdf3db-edbe-430c-a88d-020d38ae1a6c)
   
   pod log:
   
   
![Image](https://github.com/user-attachments/assets/9cfcf5bb-9fee-4702-9e60-ae2c32808a05)
   
   i also tried other ways below also doesn't work:
   
https://github.com/emesday/prefixed-superset/blob/main/nginx/conf.d/superset.conf.template
   https://www.restack.io/docs/superset-knowledge-superset-url-prefix-guide
   
https://github.com/KomootArchive/superset-reverse-nginx-example/blob/master/nginx/nginx.conf
   
   any suggestion ?
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   4.1.2
   
   ### Python version
   
   3.11
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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