The stage name is added to the url when I deploy the API. Let's say the stage name is "test", then the generated URL for the resource includes the stage name. Something like: https://abcabc.execute-api.us-east-1.amazonaws.com/test/my/path
I would like to remove the stage name in the URL. How can I do it?
Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway . Choose a REST API. Choose Stages. In the Stages pane, choose the stage you want to delete, and then choose Delete Stage.
If you want to change the URL of the integration endpoint, you need to open the "Integration Request" tab on the method settings, make sure the integration type is set to "HTTP Proxy" and update the "Endpoint URL" field.
A stage is a named reference to a deployment, which is a snapshot of the API. You use a Stage to manage and optimize a particular deployment. For example, you can configure stage settings to enable caching, customize request throttling, configure logging, define stage variables, or attach a canary release for testing.
Under the Amazon API Gateway service, select APIs . You will see the list of your APIs. Now, click the little cog wheel in the top right corner of the API that you wish to rename... Simply change the name, hit save, and you're good!
You can do this with API Gateway Custom Domains. This allows you to optionally omit the stage name in the custom domain name mapping.
I was unable to use the custom domains approach in the accepted answer because my api gateway is already in use with the stage in the url. I needed to remove the stage for a particular route. For this example, this route: https://example.com/apple-app-site-association needs to hit api gateway route: https://example.com/v1/apple-app-site-association.
Using cloudfront,
in the Origins tab, create a new origin to point to the api gateway including the stage:
Origin Domain Name: example.com
Origin Path: /v1
Origin ID: (give this a unique name and note this for next step)
(Leave remaining settings as default or change as you require, I set Origin Protocol Policy: HTTPS Only)
in the Behaviors tab, create a new behavior:
Path Pattern: /apple-app-site-association
Origin: (the Origin ID you set above)
(Leave remaining settings as default or change as you require)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With