Skip to content

Commit 958e8ca

Browse files
committed
Add CORS steps
1 parent 3c53774 commit 958e8ca

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

6-
Admin tools for [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) using Blazor Single Page Application (webassembly).
6+
Admin tools for [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) using [Blazor Single Page Application (webassembly)](https://azure.microsoft.com/en-ca/services/app-service/static/?WT.mc_id=tinyblazoradmin-github-frbouche).
77

88
![TinyBlazorAdmin][TinyBlazorAdmin]
99

deployment.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This project is a frontend only so you will need to deploy the [Azure Url Shorte
2020

2121
## Deploy TinyBlazorAdmin (the Frontend)
2222

23-
There are many ways you could run Tiny Blazor Admin website. In this deployment, we will use the new [Azure Static Web App (SWA)](https://azure.microsoft.com/en-ca/services/app-service/static/). However, because the TinyBlazorAdmin use Azure Active Directory (AAD), we need a standalone Azure Function (deployed at the previous step).
23+
There are many ways you could run Tiny Blazor Admin website. In this deployment, we will use the new [Azure Static Web App (SWA)](https://azure.microsoft.com/en-ca/services/app-service/static/?WT.mc_id=tinyblazoradmin-github-frbouche). However, because the TinyBlazorAdmin use Azure Active Directory (AAD), we need a standalone Azure Function (deployed at the previous step).
2424

2525
Open Azure portal (portal.azure.com), open the **resource group** where you created the backend (ex: streamDemo is our case). Click the "**+**" and search **Static Web App**, and click the *Create* button.
2626

@@ -106,8 +106,24 @@ Now in your GitHub it's time to update the settings. THe code need to know the A
106106
}
107107
```
108108

109+
## Enabeling Cross-Origin Resource Sharing (CORS)
109110

111+
We need to let AzUrlShortener been called by TinyBlazorAdmin. They are running in different website, therefore we need to configure Cross-Origin Resource Sharing (CORS).
110112

113+
First we need the url of the caller (aka TinyBlazorAdmin). From the Azure Portal, open the TinyBlazorAdmin SWA blade. Note the URL display in the top right of the page this is the URL of your admin page.
114+
115+
![swa_URL][swa_URL]
116+
117+
Now we need to add this URL to the list in the CORS of the Azure Function that run AzUrlShortener. From the Azure portal open the blade of AzUrlShortener. From the left menu search CORS, and click it. Add the URL of the SWA and don't forget to save.
118+
119+
120+
![azFunction_CORS][azFunction_CORS]
121+
122+
## Try it!
123+
124+
Voila, the deployment is now completed. You can test it by creating a new short URL using the admin SWA.
125+
126+
> To add a custom domain to your AzUrlShortener, [follow these steps](https://github.com/FBoucher/AzUrlShortener/blob/main/post-deployment-configuration.md#add-a-custom-domain)
111127
112128

113129
[CreateBackend]: medias/CreateBackend.png
@@ -121,4 +137,6 @@ Now in your GitHub it's time to update the settings. THe code need to know the A
121137
[tokensaccess]: medias/tokensaccess.png
122138
[swa_create1]: medias/swa_create1.png
123139
[swa_create2]: medias/swa_create2.png
124-
[swa_create3]: medias/swa_create3.png
140+
[swa_create3]: medias/swa_create3.png
141+
[swa_URL]: medias/swa_URL.png
142+
[azFunction_CORS]: medias/azFunction_CORS.png

medias/azFunction_CORS.png

161 KB
Loading

medias/swa_URL.png

125 KB
Loading

0 commit comments

Comments
 (0)