fix `Access-Control-Allow-Origin` response (#5028)

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.
This commit is contained in:
Etan Kissling 2023-06-04 18:46:00 +02:00 committed by GitHub
parent 336acbd39b
commit d99caf1ad9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -636,7 +636,7 @@ proc init*(T: type BeaconNode,
let restServer = if config.restEnabled: let restServer = if config.restEnabled:
RestServerRef.init(config.restAddress, config.restPort, RestServerRef.init(config.restAddress, config.restPort,
config.keymanagerAllowedOrigin, config.restAllowedOrigin,
validateBeaconApiQueries, validateBeaconApiQueries,
config) config)
else: else:

View File

@ -356,7 +356,7 @@ proc init*(T: type RestServerRef,
maxRequestBodySize = config.restMaxRequestBodySize * 1024 maxRequestBodySize = config.restMaxRequestBodySize * 1024
let res = try: let res = try:
RestServerRef.new(RestRouter.init(validateFn), RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
address, serverFlags = serverFlags, address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout, httpHeadersTimeout = headersTimeout,
maxHeadersSize = maxHeadersSize, maxHeadersSize = maxHeadersSize,