1

I need to add url patterns for a domain that has multiple subdomains in the Url.

For example:

https://demo.site1.mybrand.company/ Where .company is the top-level domain and mybrand is the domain.

The problem is that the demo subdomain can change based on the environment in the app, so it could be demo, or test, or anything, so I would like to make sure that any subdomain with site1.mybrand.company can access the Dynamic Links API and generate links for that Url.

What I have tried:

Firebase docs cite that these are too permission and I am not sure if Firebase supports multi-tier domains such as this.

  • ^https://.*.company/.*$
  • ^https://.*.mybrand.company/.*$
  • ^https://.*.site1.mybrand.company/.*$

Has anyone experienced this situation before or know if this particular scenario is supported?

References:

1 Answer 1

3

You might use a bit more specific pattern to match either demo or test using an alternation, and extend that to all the allowed names.

^https://(?:demo|test)\.site1\.mybrand\.company/\S*$

The pattern matches:

  • ^ Start of string
  • https:// Match literally
  • (?:demo|test) Match either demo or test
  • \.site1\.mybrand\.company/ Match .site1.mybrand.company/ (note to escape the dot)
  • \S* Match optional non whitespace chars
  • $ End of string

Regex demo

Sign up to request clarification or add additional context in comments.

5 Comments

What if I need to (?:demo|test) to be anything?
@WrightsCS you can specifiy what you would allow. You can match 1 or more word characters using \w+ like ^https://\w+\.site1\.mybrand\.company/\S*$ or you can use a more broader match for any non whitespace character except for a dot like ^https://[^\s.]+\.site1\.mybrand\.company/\S*$
In regex101 these work great and the Urls are matching, but in firebase allowlist, these Urls still arent working
@WrightsCS Did you try double escaping the backslash? ^https:\\/\\/[^\\s.]+\\.site1\\.mybrand\\.company/\\S*$
no, I might have to try that later

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.