I cannot set "allowed origins" when creating API k...
# support
a
I'm trying to create an api-key but allowed origins do not accept any of the regexes I provide. I always get a "Please enter a valid regex URL". Can you give me an example of a valid regex?
v
@Akram K. Certainly! A valid regex for an allowed origin should match the URLs you want to allow. Here's an example of a regex pattern that matches any subdomain of
example.com
using HTTPS:
Copy code
^https:\/\/(?:.*\.)?example\.com$
This regex breaks down as follows: -
^
asserts the start of the line. -
https:\/\/
matches the
https://
part of the URL. -
(?:.*\.)?
is a non-capturing group that matches any characters followed by a dot (
.
), and it's optional because of the
?
. -
example\.com
matches the domain
example.com
(the backslash escapes the dot to match it literally). -
$
asserts the end of the line. Make sure to test your regex with the URLs you expect to allow to ensure it works as intended. If you need further assistance with regex patterns or have other questions, feel free to ask!
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
a
It does not work. I get the same error message.
s
can you share the url that you are trying to add?
a
It is: site34453.weebly.com
s
add this
it will work
a
Okey! thanks, it works now. It seems the issue was that I didn't add "https:// " at the start of the url.
v
@falacios 🥷 I'm glad to hear that the issue has been resolved and that the regex is now working correctly with the inclusion of "https://". If you have any more questions or need further assistance with anything else, please feel free to ask. If everything is all set, would you like me to close this support ticket for you?
@falacios 🥷 I apologize for the confusion earlier. Let's try a different approach to create a regex that matches your URL
https://site34453.weebly.com/
. Here's a regex pattern that should work:
Copy code
^https:\/\/site34453\.weebly\.com\/?$
This regex will match the URL starting with
https://
, followed by your specific subdomain and domain, and allows for an optional trailing slash at the end. The backslashes (
\
) are used to escape special characters like
.
to ensure they are treated as literal periods in the URL. Please try using this regex pattern and see if it is accepted. If you encounter any further issues, let me know, and I'll be happy to assist you further.
@falacios 🥷 I'm sorry to hear that the example provided is not working. It's possible that the system you are using to create the API key has specific requirements or a particular format for regex that it accepts. Here's a simplified regex that should work in most cases:
Copy code
^https:\/\/site34453\.weebly\.com\/?$
This regex ensures that the URL starts with
https://
, followed by your exact subdomain and domain, and optionally ends with a forward slash. If this still doesn't work, it might be best to consult the documentation of the system you're using to see if there are any specific guidelines for the regex patterns, or reach out to their support team for assistance. If you need further help or have any other questions, please let me know.
2 Views