How to optimize the request speed (NGINX) of OPTIONS when making cross-domain requests

because the interface involves cross-domain problems, nearly 600ms per interface request is a waste of time for OPTIONS requests. How to optimize this process, for example, nginx configuration returns directly across domains without program processing (php)

Php
Mar.03,2021

Cross-domain also follow the ngx? of your local domain Or is your local ngx acting as a cross-domain proxy?

< hr >

ngx setting:

if ($request_method = OPTIONS ) {
    add_header Access-Control-Allow-Origin "*";
    add_header Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, DELETE";
    add_header Access-Control-Max-Age "3600";
    add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization";
    add_header Content-Length 0;
    add_header Content-Type text/plain;
    return 200;
}
Menu