If you reglue it, the glue will come through the fabric and will look worse. Just have some pros do it. Otherwise, remove the headliner board, take off the cloth, scrape off all the foam, then buy some new foam back fabric from an auto upholstery shop by taking a scrap of your old headliner with you to match.
Then, buy some spray glue, spray down the headliner board completely covering it with glue, then lay down the fabric making sure you don't get any wrinkles.
Let it dry, trim the excess of the edges, and reinstall.
You should be able to have someone do it at an upholstery shop for about $75.00.