Adjust ajax urls

s.schabbach at fluent-software.de s.schabbach at fluent-software.de
Wed Feb 5 13:12:49 UTC 2020


Dear, 

 

I just have a server where multiple web applications are running. The web applications are running on several ports and are distinguished by a virtual path. For example, the web application for our scenario is running using the virtual path “/webui”. 

 

Each virtual path passed the request to a kestrel webserver using proxy_pass to localhost. I just used the sub_filter directive to modify the response DOM (to change the url e.g. from “/” to “/webui”). Same I do with the redirects. Everything work fine, except of AJAX request. Inside of some javascript files, I use jquery to make an AJAX Call to my webservice and puts the HTTP response somewhere. Of course these jquery calls knows about fix urls, which needs to be arranged. 

 

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:

 

$.ajax({url: /Devices/Test, data: $(“#test”).serialize(),method: "POST", …})

 

And have to be translated to 

 

$.ajax({url: /webui/Devices/Test, data: $(“#test”).serialize(),method: "POST", …})

 

 

Does anyone knows how to achive that?

 

Kind regards, 

Sebastian.

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200205/52843bbd/attachment.htm>


More information about the nginx mailing list