Deploy an angular universal app through netlify functions

hello great team,
i am trying to deploy an angular universal (Server side rendering) to netlify functions,
the function works fine and render the app, but i have some issues with the redirects, witch:

  • if i redirect all traffic to the function, i can’t exclude assets files for example in my redirect file i have this line.
/*    /.netlify/functions/main    200

witch will redirect every call to the server to render the app and return the output.
before that i want to exclude assets files published on the main site, i added this line before everything else inside the redirects file but without any success:

/*.js   /:splat 200!

image (1)


full redirects file:

/*.js   /:splat 200!
/*    /.netlify/functions/main    200

netlify function:

/**
 * Main function to render angular app
 * @type {((application: ServerlessHttp.Application, options?: any) => ServerlessHttp.Handler) | ServerlessHttp}
 */
const serverless = require('serverless-http');
const server = require("../dist/ui/server/main");

module.exports = server.app;
module.exports.handler = serverless(server.app);

Hi, @m.matar, in order to troubleshoot this we will need to take a look at the site and test the redirect.

Would you please send us a link to the site where these 404s are occurring?

You can private message (PM) that to one of our support staff and I’ve confirmed that PMs are enabled for your community login. Note, that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.

1 Like