we're creating a new architecture for our microfrontends, and we'd like to avoid the use of another framework to orquestrate it, like single-spa. Our company currently use IIS for other products, and we need to keep it that way.
So, in order to have multiple SPAs responding to the same address, we simply depose our built SPAs in IIS's content directory, like this:
IIS root folder:
- spa1
- spa2
I can access myhost/spa1
and myhost/spa2
normally, and navigate thought their own internal routes (we're using Angular).
The problem is, we want to have URLs without #
, and than we need to tell IIS to redirect whatever is a sub-route, to it's SPA main route.
We have something in place, it works for myhost/spa1
, myhost/spa1/detail
, but does not work for myhost/spa1/detail/1
. Let's say, the third level.
Could someone help me with this?
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SPA Rule" stopProcessing="true">
<match url="(.+)/.*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}/" />
</rule>
</rules>
</rewrite>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>