Unfortunately the functions docs are very, very superficial and neither contain any information on how to access the incoming request (e.g. HTTP headers, source IP, etc.) nor on how to return anything else than text responses.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.