Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL output format #70

Closed
xavicolomer opened this issue Aug 1, 2017 · 4 comments
Closed

URL output format #70

xavicolomer opened this issue Aug 1, 2017 · 4 comments
Labels

Comments

@xavicolomer
Copy link

Hi there,

I intend to use this plugin for versioning purposes:

Master
serverless --stage dev

Versions
serverless --stage dev --alias v1

serverless --stage dev --alias v2

Endpoints
https://{{domain}}.execute-api.eu-west-1.amazonaws.com/{{alias}}/resource

My question is, can I customize the alias format so it becomes with the plugin?
https://{{domain}}.execute-api.eu-west-1.amazonaws.com/api/{{alias}}/resource

Note the /api/ before the {{alias}}

@thanks!

@HyperBrain
Copy link
Member

HyperBrain commented Aug 1, 2017

As the alias is technically an API Gateway Stage, the way to achieve your layout is, to add a custom domain mapping to your APIG API.

Select "Custom domain names" in the AWS APIG console. Then add an URL mapping (e.g. custom domain mysvc.domain.com and configure a path like this: /api -> your-api:*.

Then you can access the different aliases as: mysvc.domain.com/api/<alias>/resource...

Remember to add a DNS alias entry for the CloudFront distribution name generated by the mapping to mysvc.domain.com

This also has the advantage, that you can map multiple APIG APIS (serverless services) to one domain with the first path element being different for each service (like /api, /users, etc.)

@xavicolomer
Copy link
Author

ok, sounds like a plan.

Do you think its a good idea to use it for versioning?

@HyperBrain
Copy link
Member

You can try. We use it currently at work for developer branch deployments, but using it for versioning also sounds good. Please give it a try and let me know if it works for that use case. Maybe I cann add this use case to the README later.

@xavicolomer
Copy link
Author

Ok.

I also need something like this, I'd like to hear some opinions :)
serverless/plugins#79

Thanks for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants