This repository was archived by the owner on Feb 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Options requests return 405 status #15
Copy link
Copy link
Open
Description
In blazor client app I want to make call to external API based on ntrada. I want to send DELETE request but httpClient sends preflight OPTIONS request. In response from API I get:
HTTP/1.1 405 Method Not Allowed
Connection: close
Date: Sun, 22 Mar 2020 10:00:31 GMT
Server: Kestrel
Content-Length: 0
Allow: DELETE
httpClient exception:
Access to fetch at 'http://localhost:5000/smth/e928eade-cd49-4bfa-b36a-5b0a7839b279' from origin 'https://localhost:4999' has been blocked by CORS policy: Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.
Shouldn't status code 200 be returned in this case?
My route config is:
- upstream: /{id}
method: DELETE
use: downstream
downstream: smth-service/smth/{id}?userId=@user_id
auth: true
bind:
- userId:@user_id
I tried to allow OPTIONS methods in that way:
- upstream: /{id}
methods:
- DELETE
- OPTIONS
use: downstream
downstream: smth-service/smth/{id}?userId=@user_id
auth: true
bind:
- userId:@user_id
but it occurred in exception:
System.Collections.Generic.KeyNotFoundException: 'The given key 'options' was not present in the dictionary.'
I also tried set forwardStatusCode to false but even then I got 405 instead of 200.
Metadata
Metadata
Assignees
Labels
No labels