- Newest
- Most votes
- Most comments
To address your questions regarding invoking a private custom domain name for private APIs:
-
It is not the default behavior of a private API to always require a host header with the ID of the API when invoking a private custom domain name. The requirement for a host header depends on how you've set up your private API and custom domain.
-
There are ways to invoke a private custom domain name for private APIs without specifying the Host header explicitly. Here are some approaches you can consider:
a) Use DNS resolution: If you've set up your private DNS correctly, you should be able to invoke the API using the custom domain name without specifying the Host header. Ensure that your Route 53 private hosted zone is properly configured to resolve the custom domain name to the VPC endpoint.
b) VPC endpoint policy: Make sure your VPC endpoint policy allows access to your private custom domain name. You may need to adjust the policy to ensure it's not blocking requests without the specific Host header.
c) Resource policies: Review both the private API resource policy and the private custom domain name resource policy. Ensure they are configured to allow access from your VPC endpoint without requiring additional headers.
d) Domain name access association: Verify that you've created a domain name access association between your VPC endpoint and the private custom domain name. This association allows you to invoke the private custom domain name while isolated from the public internet.
e) Check TLS settings: Ensure that your TLS settings are correct. Private custom domain names use the security policy of TLS-1.2 by default.
If you're still experiencing issues after checking these points, you may want to review your API Gateway configuration, VPC settings, and DNS setup to ensure everything is correctly configured for your private custom domain name.
The 403 Forbidden error you're receiving without the Host header suggests there might be an issue with your authentication or authorization setup. Double-check your resource policies, VPC endpoint policies, and API Gateway configuration to ensure they're correctly set up to allow access via the custom domain name without requiring the explicit Host header.
Remember that when using private custom domain names, you need to create separate resource policies for your private API and for your private custom domain name. To successfully invoke a private custom domain name, an API consumer needs access granted by the private custom domain name resource policy, the private API resource policy, and any applicable VPC endpoint policies or authorization on the private API.
Sources
Custom domain names for private APIs in API Gateway - Amazon API Gateway
Rest API - Best Practices for Designing Amazon API Gateway Private APIs and Private Integration
Invoke a private API - Amazon API Gateway
Relevant content
- asked 2 years ago
- asked 3 years ago
- asked a year ago
