Base solution for your next web application
Open Closed

Too many redirects #8950


User avatar
0
pascald created

Hi,

I am building a project based on ASP.Net Core and Angular.

I can run the project fone on my dev machine.

I published the project on my test server and after a while I was able to make it work...

The problem is that I have 404 errors when I refresh a page or when I pass from the host to a tenant. I tried to follow all tips here and Ican't make it work.

I added the rewrite section to the web.config but this gives me a too many redirect" error.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
    <!-- IIS URL Rewrite for Angular routes -->
    <rewrite>
      <rules>
	        <rule name="Angular Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>

      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\Eteriors.Web.Host.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />    
    </system.webServer>
  </location>
</configuration>

Here is the Chrome Network log:

It had a hard to figure out the correct settings for Cors but it is now working fine but I can't find the correct setting for that one.

What I am missing ?

Thanks,

Pascal


4 Answer(s)