Adjust ajax urls

Reinis Rozitis r at roze.lv
Wed Feb 5 15:12:02 UTC 2020


> While the AJAX request does not know anything about the NGINX Proxy, they does not know anything about the “webui” path. So I need to find a solution to manipulate these javascript code:

If the javascript files are proxied the same way (from origin server) as the application you can use the same sub_filter approach, just you have to tune the sub_filter_types (http://nginx.org/en/docs/http/ngx_http_sub_module.html#sub_filter_types ) to include javascript (by default only 'text/html' is processed).

So something like (depending on what content type your upstream sends for js files):

sub_filter_types text/html text/js text/css application/javascript text/javascript;


p.s. note also that sub_filter module doesn't support compressed content so the upstream server shouldn't gzip/deflate the responses.


rr



More information about the nginx mailing list