sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Access JS file in SPFx web part from secured Azure CDN

Open HanumantPatil opened this issue 7 years ago • 7 comments

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

  • [x] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea
  • [ ] Example checked item (delete this line)

#AzureCDN

Question: I have to access file from azure cdn in spfx app. Azure cdn is secured. While accessing js file we need add qury string. Is there any way to add the query string parameters.

Example : https://azureurl/containername/filename.js?q1=1&q2=2&q3=3

Default path is https://azureurl/containername/filename.js

JS File Path generated using base azure cdn path in mentioned in spfx webpart write-manifests.json.

{ "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json", "cdnBasePath": "" }

In which file of SPfx web part project we need to change to add query string parameter while accessing JS file form Azure CDN.

Any help will be appreciated.

Thanks for your contribution! Sharing is caring.

HanumantPatil avatar Oct 07 '19 06:10 HanumantPatil

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Oct 07 '19 06:10 msft-github-bot

Not clear... what do you mean about a "secured Azure CDN"... the private Office 365 CDN?

andrewconnell avatar Oct 08 '19 10:10 andrewconnell

No, it is Azure CDN only but while accessing file from Azure CDN we need to pass certain query string parameter as shown below

https://azureurl/containername/filename.js?q1=1&q2=2&q3=3

so how to configure CDN Base path URL with Query string parameter

HanumantPatil avatar Oct 09 '19 03:10 HanumantPatil

The cdnBasePath used to specify the root path of your cdn, so it's not the case to add query string parameters.

If you view the package file, you could find it also.

image

And you cannot deploy SPFx solutions using private CDN at least currently

OS-Lee avatar Oct 10 '19 03:10 OS-Lee

@HanumantPatil The CDN base path is used to retrieve the JS bundle & JSON manifest for your component stored in the Azure CDN. SPFx does this when loading the script. There is no capability to specify any query string parameters as SPFx's module loader is using that to load the files needed for the component when adding them to the page.

andrewconnell avatar Oct 10 '19 09:10 andrewconnell

Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.

msft-github-bot avatar Oct 13 '19 10:10 msft-github-bot

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 23 '20 12:01 msft-github-bot