Arnaud Nauwynck created SPARK-61882:
---------------------------------------

             Summary: Flame Graph not showing while running SparkUI behind a 
rewrite url proxy
                 Key: SPARK-61882
                 URL: https://issues.apache.org/jira/browse/SPARK-61882
             Project: Spark
          Issue Type: Bug
          Components: Web UI
    Affects Versions: 4.2.1, 4.2.0
            Reporter: Arnaud Nauwynck
         Attachments: Screenshot_spark_proxy_error_flamegraph.png

While running SparkUI behind a web rewrite proxy, everything works fine but not 
the "Flame Graph" embedded view in  "Executor > Thread Dump > Flame Graph"

internally, these 2 http GET request  are badly rewritten compared to all 
others, getting http 404 response on badly rewritten urls, not taking account 
of the header "X-Forwarded-Context=/my-base-path"

```
executorspage.js:126  GET http://localhost:4039/static/d3-flamegraph.css 
executorspage.js:59  GET http://localhost:4039/static/d3.min.js 
net::ERR_ABORTED 404 (Not Found)
```


To reproduce, here is a sample nginx configuration file,  to expose 
"http://localhost:4039/my-base-path/";  -> to rewrite to  
"http://localhost:4040/";

```
# file nginx.conf
# test using http://localhost:4039/my-base-path/
server {
    listen 4039;
    location /my-base-path/ {
        proxy_pass http://localhost:4040/;   # the trailing slash strips /xxx/

        # rewrite the absolute Location (built from the Host header) and 
relative ones
        proxy_redirect http://$host:$server_port/ /my-base-path/;
        proxy_redirect / /my-base-path/;

        proxy_set_header X-Forwarded-Context /my-base-path;
        proxy_set_header Host               $host:$server_port;
        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;
        proxy_set_header X-Forwarded-Host   $host:$server_port;
    
    }
}
```
Test using for example podman (or docker)
```
podman run --rm --network host -v 
$PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro  docker.io/library/nginx
```

then open url  "http://localhost:4039/my-base-path/";
Then click on "Executors" > choose one (ex:"driver") > "Thread Dump" > "Flame 
Graph"

cf screenshot (attachment file),   the "Flame Graph" part is empty, and there 
are errors in web "Dev Tools"  (console or network tabs)





--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to