Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Spark Web-UI with nginx

I need configure spark web-ui with nginx .

My configuration

 location /app/spark/master {
            proxy_pass http://192.168.230.45:8080/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }

but when i try to access the url, the images and css are not loaded(404 not found).

Now assume the images and css files in static folder of my remote machine(192.168.230.45) but the url points to static folder of my nginx installed machine.

http://localhost/static/img1.png

instead

http://192.168.230.45/static/img1.png

like image 261
Karthick Radhakrishnan Avatar asked Feb 15 '26 20:02

Karthick Radhakrishnan


1 Answers

I've lost a couple of days being looking for solution. Finally I've found out how to resolve this problem. Here is my resolution of our issue:

location /app/spark/master/ {
        proxy_pass http://192.168.230.45:8080/;
        proxy_set_header Accept-Encoding "";
        sub_filter "/static/" "/app/spark/master/static/";
        sub_filter_once off;
}

In addition You'll face there similar problem with "history"-like links. Solution will be the same. Just add the line:

sub_filter "/history/" "/app/spark/master/history/";

And voila!

like image 94
Vladimir Sh. Avatar answered Feb 19 '26 07:02

Vladimir Sh.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!