If by any chance you are running CGI you can't assign it to the main folder of your application as files such as CSS or JS will be tried to be "Exec"-ed by Apache resulting in
AH01215: (8)Exec format error: exec of ERROR inside /var/log/apache2/error.log
Create separate folder for executable files only and add something like this to your /etc/apache2/sites-enabled/sub.domaian.com.conf
allow from all
Require all granted
AddHandler cgi-script .py
Interesting enough: I had SetHandler cgi-script assign to main folder and in my situation I could open the page with no issue when I was accessing the page through LAN but not from WAN.