API Gateway Custom domain name not working

0

I have an API Gateway deployment with no authentication and a custom domain name, which works (e.g., https://services.myapp.com/v1/listingService). However, when I add a path in the API mappings as per the documentation, appending it to the URL (e.g., https://services.myapp.com/test/v1/listingService) should work. Instead, I get the error: 'Not Found - The requested URL was not found on the server.

Can someone help me understand the issue? Thank you

1 Answer
0

The issue you're experiencing with your API Gateway custom domain name not working as expected when adding a path in the API mappings is likely related to how you've configured your base path mappings.

When you set up a custom domain name in API Gateway, you can create base path mappings to connect specific paths of your custom domain to different API stages. However, it's important to understand how these mappings work:

  1. The base path you specify in the mapping becomes part of the URL path for your API.

  2. If you've set up a base path mapping with the path "test", requests to "https://services.myapp.com/test" will be routed to the root ("/") of your API.

  3. In your case, when you're trying to access "https://services.myapp.com/test/v1/listingService", API Gateway is likely looking for a resource at "/v1/listingService" in the API stage mapped to the "test" base path, which probably doesn't exist.

To resolve this issue, you have a few options:

  1. If you want to keep your current API structure, remove the base path from your custom domain mapping. This way, "https://services.myapp.com/v1/listingService" will work as before.

  2. If you want to use the "test" path, you need to update your API structure to include the "test" path in your resource paths. For example, your API resource would need to be "/test/v1/listingService" instead of just "/v1/listingService".

  3. Alternatively, you could create a new stage of your API with the desired base path structure and map it to the "test" path in your custom domain.

Remember to deploy your API after making any changes to ensure they take effect. Also, it may take some time for changes to propagate, so allow a few minutes before testing again.

If you're still encountering issues after trying these solutions, you may want to double-check your API Gateway configuration, ensuring that all mappings and integrations are set up correctly.

Sources
Custom domain names for HTTP APIs in API Gateway - Amazon API Gateway
Custom domain name for public REST APIs in API Gateway - Amazon API Gateway
Set up an edge-optimized custom domain name in API Gateway - Amazon API Gateway

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions