Reverse Proxy IIS

Currently i try to setup n8n under a reverse proxy in iis.
iis is unfortunately obliged.
the frontend is avaible under n8n.intranet.local but throws some exceptions:

GET http://n8n.intranet.local/rest/push?sessionId=***** 404 (Not Found)
GET http://n8n.intranet.local/rest/credentials 404 (Not Found)
GET http://n8n.intranet.local/rest/active 404 (Not Found)
GET http://n8n.intranet.local/rest/credential-types 404 (Not Found)
GET http://n8n.intranet.local/rest/node-types 404 (Not Found)
GET http://n8n.intranet.local/rest/settings 404 (Not Found)

Does anyone have any hints?

n8n.json:

{
	"protocol": "http",
	"host": "localhost",
	"listen_address": "0.0.0.0",
	"port": 5678
}

pm2.config.js:

module.exports = {
	apps : [{
		name: 'n8n',
		cwd: 'C:/ProgramData/npm/npm/node_modules/n8n/bin/',
		script: 'C:/ProgramData/npm/npm/node_modules/n8n/bin/n8n',
		env: {
			N8N_CONFIG_FILES : 'D:/n8n.json',
			WEBHOOK_TUNNEL_URL: 'http://n8n.intranet.local/',
			VUE_APP_URL_BASE_API: 'http://n8n.intranet.local/'
		},
		error_file : 'D:/n8n/log/out.log',
		out_file : 'D:/n8n/log/out.log'
	}]
};

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="n8n" stopProcessing="true">
                    <match url=".*" />
                    <action type="Rewrite" url="http://127.0.0.1:5678/{C:0}" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^n8n.intranet.local$" />
                        <add input="{PATH_INFO}" pattern=".*" />
                    </conditions>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

To work under iis you need disable response buffer threshold:

Also the web.config is simpler:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="n8n" stopProcessing="true">
                    <match url=".*" />
                    <action type="Rewrite" url="http://127.0.0.1:5678/{R:0}" appendQueryString="true" logRewrittenUrl="false" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^n8n.intranet.local$" />
                    </conditions>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
1 Like