javascript – OPTIONS Request made to domain root (/) on ddev nginx throws a 405 – We see access.log but the request is not forwarded to index.php
The issue it turns out is specific to the nginx configuration being used with DDev.
the inclution of the $uri/ element in the location try_files configuration results in a failier to correctly route OPTIONS requests made to the base domain onwards to the application.
As it turns out, $uri/ is in general not required for most modern web applications due to the almost ubiquitous use of a single exposed index file to handle all requests made to an application. As such, it can be safely removed, resolving the issue.
See Discussion here: github.com/serversideup/docker-php/issues/89
The specific fix is simple.
In the .ddev/nginx_full/nginx-site.conf file change:
location / {
absolute_redirect off;
try_files $uri $uri/ /index.php?$query_string;
}
to
location / {
absolute_redirect off;
try_files $uri /index.php?$query_string;
}
You will also need to remove the ##ddev generated comment at the top of the file to prevent the file being overwritten again.
Then restart ddev
ddev restart
and that should solve the issue.
Read more here: Source link
