Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Remove websocket prefix from domain name output #118

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

Conversation

acormier-maia
Copy link
Contributor

@acormier-maia acormier-maia commented Aug 12, 2024

Description

Strip off the wss:// prefix from the stage_domain_name output in the case of websocket api. This should fix #117

Motivation and Context

We want to use a single Cloudfront domain for all our services (S3, API Gateway HTTP, API Gateway Websocket). In order to configure the Cloudfront Origin you need to pass in a domain name. I noticed that this value was not being set correctly.

Breaking Changes

I don't believe anyone would be using the incorrect domain name for websocket.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
    I ran against the websocket example before and after the change to verify that stage_domain_name is set correctly.
  • I have executed pre-commit run -a on my pull request

@@ -103,7 +103,7 @@ output "stage_id" {

output "stage_domain_name" {
description = "Domain name of the stage (useful for CloudFront distribution)"
value = replace(try(aws_apigatewayv2_stage.this[0].invoke_url, ""), "/^https?://([^/]*).*/", "$1")
value = replace(try(aws_apigatewayv2_stage.this[0].invoke_url, ""), "/^(wss?|https?)://([^/]*).*/", "$2")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick and dirty test - looks good
image

@bryantbiggs bryantbiggs changed the title Fix regex to support removing websocket prefix fix: Remove websocket prefix from domain name output Aug 12, 2024
@bryantbiggs bryantbiggs merged commit c6c0b01 into terraform-aws-modules:master Aug 12, 2024
8 of 12 checks passed
antonbabenko pushed a commit that referenced this pull request Aug 12, 2024
## [5.1.3](v5.1.2...v5.1.3) (2024-08-12)

### Bug Fixes

* Remove websocket prefix from domain name output ([#118](#118)) ([c6c0b01](c6c0b01))
@antonbabenko
Copy link
Member

This PR is included in version 5.1.3 🎉

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stage_domain_name output for websocket api returns wss protocol and stage_id
3 participants