Azure-docs: Possible to setup SPA routing?

Created on 2 Oct 2018  ·  12Comments  ·  Source: MicrosoftDocs/azure-docs

Hi,
It's not clear in the documentation if it's possible to setup client-side routing with SPAs. It seems to only support folder based routing which is something not as common as modern SPA routing. I get that the web serving capabilities are limited but it would be nice to clear things out in the documentation.
Thanks


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 assigned-to-author doc-enhancement storagsvc triaged

Most helpful comment

I don't think this issue should be closed. The documentation has not been updated and the work around of setting the Error document path is not ideal because every page will return a 404 status code.

A SPA hosting option is a key feature for static site hosting, which services like Netlify and Zeit support by default. It really needs to be, at the very least, mentioned in the docs.

All 12 comments

Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.

yohanb, you make a good point. SPA should be do-able with CSS though it's constrained compared to server side execution. I added a task to provide more clarity on SPA.

please-close

Hello, @klaaslanghout - Was this documentation ever published?

in yejoor bazie !ehtemal entesharesh cheghadre?

ارسال شده از پست الکترونیکیhttps://go.microsoft.com/fwlink/?LinkId=550986 مخصوص Windows 10


فرستنده: Won Song notifications@github.com
‏‏ارسال شده: Wednesday, November 28, 2018 2:10:11 AM
گیرنده: MicrosoftDocs/azure-docs
گیرنده کپی: Subscribed
‏‏موضوع: Re: [MicrosoftDocs/azure-docs] Possible to setup SPA routing? (#16003)

Hello, @klaaslanghouthttps://github.com/klaaslanghout - Was this documentation ever published?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/MicrosoftDocs/azure-docs/issues/16003#issuecomment-442245581, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALy7D1i79OAYAccbfV_NqZoU2QCIwRAMks5uzb9LgaJpZM4XEFUh.

Hi @klaaslanghout, could you please explain how the routing should be set up or point to the documentation? Also, what do you mean by saying SPAs should be doable with CSS?

I don't see the documentation anywhere also but it seems like if you set the Error document path to also index.html it does a path rewrite and the client routing seems to work.

image

I've only tested it briefly but it seems to kind of work, inspecting the network tab shows it returns 404 in the initial request then the browser seems to deal with it once it gets to the index. I don't know what its doing in the background but it does feel a little hacky.

I don't think this issue should be closed. The documentation has not been updated and the work around of setting the Error document path is not ideal because every page will return a 404 status code.

A SPA hosting option is a key feature for static site hosting, which services like Netlify and Zeit support by default. It really needs to be, at the very least, mentioned in the docs.

@daniellittledev I agree, there's currently no solution to this and the documentation still doesn't mention anything.

Here is the solution https://medium.com/@antbutcher89/hosting-a-react-js-app-on-azure-blob-storage-azure-cdn-for-ssl-and-routing-8fdf4a48feeb

This solution also works very well and is easy to understand
https://stackoverflow.com/a/59974770/2311105

In short: Just rewrite all requests without a file extension to index.html

Was this page helpful?
0 / 5 - 0 ratings