over-the-air VPN profile delivery to iOS

First, the question background:

I'm making an app which allows users to connect to specific VPN to circumvent their county internet restrictions. I use L2TP over ipsec linux VPN server with self-signed CA certificate.

I want the app to install VPN settings and certificate so that user can have VPN ready to use VPN simply by clicking button inside the app. However, I'm struggling to understand how exactly over-the-air VPN profile and certificate delivery work.


Now the question I have:

How can I automatically generate configuration profiles on server when a new device connects to the server? (I know it has to do something with relative URL called from application)