0

I've deployed a Spring Boot application on AWS. This application contains Spring REST APIs that allow an front-end application to retrieve data.

Say I want to make an request to an API, such as

https://example.com/api/states/search/findByCountryCode?code=US

The entire query string (the question mark and everything after) is dropped.

https://example.com/api/states/search/findByCountryCode

Therefore, instead of returning results from the database, I'm returned an empty result set.

What could be the cause of this, and I do I fix it?

Note: I set up a CloudFront distribution in front of my application's Elastic Beanstalk environment, so I don't know if that has something to do with it...

  • At what point are you seeing that it is dropped? Where exactly are you logging the request and seeing the query string is dropped? Also, please include your CloudFront query string settings as described here: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/QueryStringParameters.html CloudFront may definitely be dropping the query string if you have that configured incorrectly. – Mark B Mar 11 '23 at 15:01
  • @MarkB Thanks so much for pointing that article out to me! It definitely helped me figure it out. After just a bit more digging, I found the solution to my problem in this article: https://stackoverflow.com/questions/54965779/how-to-configure-query-params-in-aws-cloudfront Now my application is working like a charm. Thanks again! – Mikey Allen Mar 11 '23 at 15:48

1 Answers1

0

You must provide more info about how you make the API call from the front-end. You might wanna check some old questions about the reasson this might happen:

When submitting a GET form, the query string is removed from the action URL

Query Params get removed from react route when click on button

PTsag
  • 108
  • 2
  • 9