ADringer ADringer - 5 months ago 12
Node.js Question

Express routing with a '+' in the path

I'm using express to host my Angular2 app in Azure.

As per the Angular2 style guide, I've marked some components as lazy loaded by prefixing the folder with a '+'.

When I try to GET a file in this folder (e.g. app/+about/about.component.ts) it returns a 404. However when the '+' is not in the folder name it works.

My Express config for the 'app' folder is

app.use("/app", express.static('app'));

From looking at the documentation for Express I can see the '+' is used for regex patterns, but couldn't see a way to escape this. What is the workaround?



Found my issue:

So I'm building and deploying a nodejs app in Azure by following the instructions as documented here and have found the issue is with IIS.

If I look at the logs I can see the error:

The request filtering module is configured to deny a request that contains a double escape sequence.

If I add the following to the web.config file then it works ok:

  <requestFiltering allowDoubleEscaping="true" />