Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation : Working configuration for Angular 17 SSR #139

Open
ebiton-eig opened this issue Dec 20, 2023 · 1 comment
Open

Documentation : Working configuration for Angular 17 SSR #139

ebiton-eig opened this issue Dec 20, 2023 · 1 comment

Comments

@ebiton-eig
Copy link

ebiton-eig commented Dec 20, 2023

To use iisnode with an Angular 17 SSR application, follow these steps:

Install the latest versions of iisnode and node.js.
By default, iisnode cannot handle .mjs files. To overcome this problem, change the last line of the interceptor.js (C:\Program Files\iisnode) file to :

require('child_process').spawn(process.argv[0], process.argv.slice(1));

Copy all the files in the dist folder into the directory that will serve your application.

Create a web.config file at the rout of this directory with the following contents:

<configuration>
  <system.webServer>

    <handlers>
      <add name="iisnode" path="server/server.mjs" verb="*" modules="iisnode" />
    </handlers>

    <rewrite>
      <rules>
        <rule name="StaticFiles" stopProcessing="true">
          <match url=".*\.(css|jpg|png|gif|js|ico|html|svg|json|woff|woff2|ttf|webp|webmanifest)$" />
          <action type="Rewrite" url="browser/{R:0}" />
        </rule>
        <rule name="DynamicContent">
          <match url="/*" />
          <action type="Rewrite" url="server/server.mjs" />
        </rule>
      </rules>
    </rewrite>
    
  </system.webServer>
</configuration>

Your Angular 17 SSR application should be well served!

@mssynapseindia
Copy link

@ebiton-eig , I released the angular SSR copy in same manner and website is running but i am getting unexpected 500 error randomly , see error below:

iisnode encountered an error when processing the request.

HRESULT: 0x6d
HTTP status: 500
HTTP subStatus: 1013
HTTP reason: Internal Server Error

Any solution here ,please advise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants