mirror of https://github.com/tiangolo/fastapi.git
866 B
866 B
You can add headers to your response.
Create a response as described in Return a Response directly and pass the headers as an additional parameter:
{!./src/response_headers/tutorial001.py!}
!!! tip Have in mind that custom proprietary headers can be added using the 'X-' prefix.
But if you have custom headers that you want a client in a browser to be able to see, you need to add them to your <a href="https://fastapi.tiangolo.com/tutorial/cors/" target="_blank">CORS configurations</a>, using the parameter `expose_headers` documented in <a href="https://www.starlette.io/middleware/#corsmiddleware" target="_blank">Starlette's CORS docs</a>.