Home  >  Q&A  >  body text

Can nginx add custom headers to html?

I want nginx to read a configuration string when receiving a request, if it is a specific file, add it to the header of this html file, and return it together as a custom header. Is it possible?
Or is there any other way to send the string in the configuration file together with the html file, instead of going through the overhead of another ajax request for a string?

漂亮男人漂亮男人2713 days ago423

reply all(1)I'll reply

  • 阿神

    阿神2017-05-16 17:22:42

    It can be realized. The location conditions can be combined with regular expressions. Use add_header to increase the content of the returned http header

    add_header X-Hello world

    reply
    0
  • Cancelreply