Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API Gateway Proxy to VPC Link

I am trying to use API Gateway to route traffic to an internal network load balancer.

All routes to the base path (/) are working, so I know the VPC Link is up and reachable.

I added a proxy resource (/{proxy+}), with ANY http method. In the ANY "Integration Request" I selected:

  • Integration Type: VPC Link
  • Use Proxy Integration
  • Method: ANY
  • VPC Link: My-VPC-link (abcdefg)
  • Endpoint URL: (i.e. http://abcd1234.cloudfront.net/{proxy})

I can see that the my web server responds with a redirect:

(b9d0c629-31ec-11e8-b452-0f13c3c62b81) Endpoint response body before 
transformations: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="http://abcd1234.cloudfront.net/api/">http://abcd1234.cloudfront.net/api/</a>. If not click the link.
(b9d0c629-31ec-11e8-b452-0f13c3c62b81) Method completed with status: 301

The web page shows:

{"message":"Forbidden"}

Also, if I try to directly link to the CloudFront URL I get the same error.

In addition to the CloudFront URL, I've also tried the following:

  1. Custom Domain Name

    403 Forbidden

  2. The URL of my deployed stage

    {"message": "Internal server error"}

What URL should be in the 'Endpoint URL' field in the integration request?

like image 582
Chris Rouffer Avatar asked Nov 08 '22 08:11

Chris Rouffer


1 Answers

It turns out that the API-Gateway must call the VPC Link with 'http' not 'https' for the VPC Link URL.

like image 116
Chris Rouffer Avatar answered Dec 12 '22 12:12

Chris Rouffer