Home  >  Q&A  >  body text

How to rewrite based on custom header in nginx

I am working on an API interface recently and want to write the API version to the header. So how do I get this variable from nginx and rewrite it according to it? Mainly, I don't know how to get this custom variable. Please, fellow Taoists

高洛峰高洛峰2713 days ago512

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:23:16

    It is recommended to write the version number into the url, either path or parameter. nginx can easily get this value in the configuration file and process it.
    If it is a header, you need to compile and configure another module.

    reply
    0
  • Cancelreply