简体   繁体   中英

Use angular2 app using Azure blob storage and Azure proxy functions

I uploaded angular app "dist" folder into Azure blob storage.
I can run index.html from inside the blob, and it will run application.
Now, I want to create some Azure proxy function that will redirect to this blob and will run angular app.
But when I run this proxy, I get exception:

error_handler.js:48 EXCEPTION: Uncaught (in promise): SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'StorageUrl/ContainerName/' cannot be created in a document with origin 'FunctionUrl' and URL 'FunctionUrl/ContainerName'. Error: Failed to execute 'replaceState' on 'History': A history state object with URL 'StorageUrl/ContainerName/' cannot be created in a document with origin 'FunctionUrl' and URL 'FunctionUrl/ContainerName'.

Does anyone saw this error?

I am able to reproduce the error which is more about Angular's issue. The official doc says:

The router uses the browser's history.pushState for navigation. Thanks to pushState , you can make in-app URL paths look the way you want them to look, eg localhost:3000/crisis-center . The in-app URLs can be indistinguishable from server URLs.

And from Mozilla pushState documentation :

The new URL must be of the same origin as the current URL; otherwise , pushState() will throw an exception.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM