OPTIONS http methods gives an empty response on Heroku

前端 未结 2 888
一生所求
一生所求 2021-01-19 17:37

When I do things locally my CORS calls are working fine

$ curl -i -X OPTIONS \"http://localhost:3000/api/v1/login\"
HTTP/1.1 200 OK
X-Powered-By: Express
Acc         


        
相关标签:
2条回答
  • 2021-01-19 18:12

    I filed a ticket for this, as it turned out, things were not easy to troubleshoot, but the answer is very simple: make your calls using https instead of http

    0 讨论(0)
  • 2021-01-19 18:12

    Getting no response might be caused by configuration similar to this:

    if ($request_method !~ ^(GET|HEAD|POST|PUT|DELETE)$ ) {
        return 444;
    }
    

    Which means that nginx will close the connection without a proper response, that's why this is so difficult to debug.

    Search your configuration for the 444 return code. If you find something like the above, just add OPTIONS to the list).

    0 讨论(0)
提交回复
热议问题