Home  >  Q&A  >  body text

How to customize response headers in nginx

I just want to add custom fields to the response header

黄舟黄舟2713 days ago660

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:18:12

    add_header 'Some-header' 'someValue';

    I think you can find a bunch of answers to this question in a hundred searches. .
    But if I ask here again, I must have encountered other problems. .

    Warm reminder of a pitfall. For response headers defined by nginx, remember not to use underscores. When taking this header, in some languages, such as PHP.
    What you define isSome-header,取是取HTTP_SOME_HEADER

    reply
    0
  • Cancelreply