Skip to content
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

Error "CORS Rejected - Invalid origin" on RPC calls #6983

Closed
ahamlat opened this issue Apr 23, 2024 · 1 comment
Closed

Error "CORS Rejected - Invalid origin" on RPC calls #6983

ahamlat opened this issue Apr 23, 2024 · 1 comment
Assignees

Comments

@ahamlat
Copy link
Contributor

ahamlat commented Apr 23, 2024

Description

With origin header is set to empty, meaning that the header exists but doesn't have a value, we have this error : "CORS Rejected - Invalid origin" when calling RPC methods.
This is related to this #6666, as the regex is now more restrictive.

Acceptance Criteria

RPC methods should reply with the correct output when RPC and the namespace is enabled.

Steps to Reproduce (Bug)

  1. Start Besu with RPC and ETH namespace enabled
  2. Call eth_blockNumber
curl --location 'http://localhost:8545' \
--header 'Origin;' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
}'
  1. Besu replies with Exception thrown handling RPC and we can see this error line in the code
{"@timestamp":"2024-04-23T13:24:05,906","level":"ERROR","thread":"vert.x-eventloop-thread-1","class":"Logging403ErrorHandler","message":"CORS Rejected - Invalid origin","throwable":""}

Expected behavior: [What you expect to happen]
Besu should reply here with the chain head block number

Actual behavior: [What actually happens]
Error

Frequency: [What percentage of the time does it occur?]
Always (when origin is empty)

@ahamlat
Copy link
Contributor Author

ahamlat commented Apr 29, 2024

Fixed with #6988

@ahamlat ahamlat closed this as completed Apr 29, 2024
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

No branches or pull requests

1 participant