Changed how the debug flag is retrieved, added allowed hosts for when debug=true.