Welcome! Log In Create A New Profile

Advanced

Adjust ajax urls

Anonymous User
February 05, 2020 08:14AM
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.







_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Adjust ajax urls

Anonymous User February 05, 2020 08:14AM

RE: Adjust ajax urls

Reinis Rozitis February 05, 2020 10:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 284
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready