|
From: Gustaf N. (sslmail) <ne...@wu...> - 2025-11-07 08:59:00
|
The following should work:
# Simple CORS-style preflight handler
ns_register_proc OPTIONS /api/* {
ns_set put [ns_conn outputheaders] Access-Control-Allow-Origin "*"
ns_set put [ns_conn outputheaders] Access-Control-Allow-Methods "GET, POST, OPTIONS"
ns_set put [ns_conn outputheaders] Access-Control-Allow-Headers "Content-Type, X-Requested-With"
ns_return 204 text/plain ""
}
-g
> On 07.11.2025, at 09:31, Decent Espresso <dec...@gm...> wrote:
>
> I’m being asked why naviserver doesn’t seem to support the OPTIONS method, which CORS can occasionally use.
>
> Perhaps it does, and I haven’t configured it?
>
> curl -X OPTIONS http://decentespresso.com <http://decentespresso.com/>
> <!DOCTYPE html>
> <html lang='en'>
> <head>
> <meta charset='UTF-8'>
> <meta name='viewport' content='width=device-width, initial-scale=1.0'>
> <title>Method Not Allowed</title>
> </head>
> <body>
> <h2>Method Not Allowed</h2>
> The requested method is not allowed on this server.
> <p style='text-align: right; font-size: small; font-style: italic;'>
> NaviServer/5.0.1
> </p>
>
> </body>
>
>
> _______________________________________________
> Naviserver-users mailing list
> Nav...@li... <mailto:Nav...@li...>
> https://lists.sourceforge.net/lists/listinfo/naviserver-users
|