Skip to content

fix: handle preflight requests #2175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2025
Merged

fix: handle preflight requests #2175

merged 3 commits into from
Mar 26, 2025

Conversation

vansangpfiev
Copy link
Contributor

@vansangpfiev vansangpfiev commented Mar 26, 2025

Describe Your Changes

This pull request includes several changes to the RunServer function in the engine/main.cc file, focusing on improving signal handling, API key validation, and CORS handling.

Signal handling improvements:

  • Removed an extra semicolon in the signal handler for better code clarity.

API key validation and CORS handling:

  • Refactored the API key validation logic to be part of a new pre-routing advice, which now also handles OPTIONS preflight requests for CORS.
  • Consolidated and simplified the CORS handling into a single function handle_cors, which is used in both pre-routing and post-handling advices. [1] [2]

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@vansangpfiev vansangpfiev changed the title fix: handle options preflight fix: handle preflight requests Mar 26, 2025
@vansangpfiev vansangpfiev marked this pull request as ready for review March 26, 2025 05:25
@vansangpfiev vansangpfiev merged commit 588aa95 into dev Mar 26, 2025
8 checks passed
@vansangpfiev vansangpfiev deleted the s/fix/options branch March 26, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants