vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
17.48k stars 1.53k forks source link

HTTP Server source does not support OPTIONS request method #21169

Open xiazuojie opened 3 weeks ago

xiazuojie commented 3 weeks ago

A note for the community

Use Cases

Currently, http_server source supports DELETE, GET, HEAD, PATCH, POST, and PUT request methods. OPTIONS request method is somehow missing. We want vector's http server to handle CORS preflight request which uses OPTIONS request method.

[sources.http_options]
type = "http_server"
address = "0.0.0.0:8080"
encoding = "binary"
method = "OPTIONS"
strict_path = false

[sinks.blackhole]
type = "blackhole"
inputs = ["http_options"]
buffer.max_events = 1000
buffer.type = "memory"

Attempted Solutions

Add support of OPTIONS request method in the code.

Proposal

No response

References

No response

Version

0.40.1

jszwedko commented 3 weeks ago

Hi @xiazuojie !

Can you clarify if you mean you want either:

  1. The http_server simply to OPTIONS requests with the valid request methods
  2. The http_server to accept OPTIONS requests but then generate events based on them. If so, what content would you like to see in the event?
xiazuojie commented 2 weeks ago

Hi @xiazuojie !

Can you clarify if you mean you want either:

  1. The http_server simply to OPTIONS requests with the valid request methods
  2. The http_server to accept OPTIONS requests but then generate events based on them. If so, what content would you like to see in the event?

I mean option 2. The content should be the same as any other request methods. For OPTIONS request method, the http body is usually null but the headers and query params could be used.