Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-81

use nginx to send OPTIONS responses

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Normal Normal
    • None
    • API
    • None

      The lastfm importer sends an OPTIONS request to our endpoint every time we submit an item. This results in lots of requests to flask only for it to say "yes, OK".
      It looks like it's possible to do this all in nginx:
      http://blog.rogeriopvl.com/archives/nginx-and-the-http-options-method/

      Though there are some considerations about "if" to be careful of:
      https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/

      Specifically however, it says
      There are cases where you simply cannot avoid using an if, for example if you need to test a variable which has no equivalent directive.

      if ($request_method = POST ) {
      return 405;
      }

            kartik1712 amCap1712
            alastairp Alastair Porter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package