Skip to content

Commit

Permalink
fix Access-Control-Allow-Origin response (#5028)
Browse files Browse the repository at this point in the history
Since #3976, CORS functionality is broken. Fix it to work again:

- Use `--rest-allowed-origin` instead of `--keymanager-allowed-origin`
  to specify CORS `Access-Control-Allow-Origin` header for beacon-APIs.

- Actually pass CORS config to `nim-presto` once more.
  • Loading branch information
etan-status authored Jun 4, 2023
1 parent 336acbd commit d99caf1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ proc init*(T: type BeaconNode,

let restServer = if config.restEnabled:
RestServerRef.init(config.restAddress, config.restPort,
config.keymanagerAllowedOrigin,
config.restAllowedOrigin,
validateBeaconApiQueries,
config)
else:
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/nimbus_binary_common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ proc init*(T: type RestServerRef,
maxRequestBodySize = config.restMaxRequestBodySize * 1024

let res = try:
RestServerRef.new(RestRouter.init(validateFn),
RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout,
maxHeadersSize = maxHeadersSize,
Expand Down

0 comments on commit d99caf1

Please sign in to comment.