CMR-10226: Item search not working in STAC Browser #365
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the feature?
When using Radiant Earth for item search, we are seeing "Network Error". The network tab shows a 301 error for these requests.
The Application Load Balancer (ALB) configuration in our
serverless.yml
file only specified GET and POST methods for the STAC API endpoints. However, Radiant Earth sends an OPTIONS request as part of the CORS preflight process before making a POST request for item searches. Without handling for the OPTIONS method, these preflight requests were resulting in a 301 redirect, causing the CORS error.What is the Solution?
Updated the
serverless.yml
file to include OPTIONS in the list of allowed methods for the ALB event configuration. This change allows the ALB to properly route OPTIONS requests to our Lambda function, which can then respond with the appropriate CORS headers. I deployed my branch to SIT to verify these changes indeed work.Screenshots from SIT