When you use iisnode to host the Node.js blogging software Ghost on your IIS web server, and you set up an SSL certificate for your Ghost website, you may run into too many redirect issues when changing Ghost’s
config.js file. This happend to me yesterday, and here is the solution.
The most important thing I forgot is that IIS acts as a reverse proxy for Node.js web applications when you install iisnode. I had my SSL certificate set up in IIS, put my HTTP to HTTP redirect in place and updated my Ghost
server: production environment config in
config.js, I changed http to https.
Assuming all was correct and in place, I recycled my application pool, which is necessary for Ghost config changes, and refreshed my browser. Only to find an error HTTP 310 Too many redirects… Darn!
TL;DR, read this blog post to find the answer.
config.js changes, the problem went away. Googling on the “HTTP 310 Too many redirects” error, I found the above mentioned blog post, and all pieces came together falling into place:
IIS acts as a reverse proxy through iisnode for the Node.js web applications. Node.js runs its own HTTP web server on localhost. Doh! How could I forget… Anyway, create an
iisnode.yml file in your web root (or edit the file if it exists), and add (or change):
The enableXFF setting controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host. After recycling your application pool, Ghost runs on HTTPS / port 443 in Node.js without problems. You can find more iisnode configuration settings in iisnode’s web.config
This means you don’t have to create an
iisnode.yml file if it doesn’t exist. Make your change in the
<iisnode node_env="%node_env%" loggingEnabled="false" debuggingEnabled="false" devErrorsEnabled="false" nodeProcessCommandLine=""c:\path\to\node.exe"" enableXFF="true" />
My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, WordPress, websites & optimization. Want to support me and donate? Use this link: https://paypal.me/jreilink.
11+ Tips to optimize Umbraco CMS
Start all stopped application pools that have Autostart set to true
How to install Microsoft’s SQL Server Driver for PHP
HackRepair.com’s Bad Bots .htaccess in web.config for IIS
IIS URL Rewrite “Rewrite Module error: Expression contains a repeat expression”
Deny vulnerable WordPress plugins using Windows Server File Server Resource Manager’s File Screens
RewriteProxy with .htaccess in IIS
How to optimize PHP OPcache configuration