I need to run a script from nginx (preferably PHP) before every request. All my served pages are plain HTML. Googling took me as far as LUA but, even though I have full access to server I would rather not change anything apart from nginx configuration (either
php5-fpm also running on-site.
The reason is, we would like to allow developers do create HTML static one-page-apps that would need to AJAX post to an external API. CORS and all setup fine, all good, but we wanted to initiate a session on the destination API server.