Problem login in on 1-click Wordpress install after using proxy

June 7, 2015 1.5k views
Apache WordPress System Tools

Currently my wordpress blog (hosted on DO) is displayed at and I am trying to display it on is an heroku application (node) so I set up a proxy using express-http-proxy with the following (on the heroku side):

app.use('/blog', proxy('', {
     forwardPath: function(req, res) {
        return require('url').parse(req.url).path;

ON DO's side, I have changed the wordpress home url and site url in the wp-config.php like so:


My blog displays well on but I can't seem to login on the wordpress admin page (/wp-admin), I always get the error:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

Of course my cookies are enabled and I tried different browsers . I am sure I am missing something but I can't figure it out. Do you have any ideas?

1 Answer

It sounds like that the proxy could be dropping the cookies when passing on requests. express-http-proxy has a preserveHostHdr setting that will make sure the host HTTP headers are passed along. Doing some testing, this seems to work quite well:

var express = require('express');
var app = express();
var proxy = require('express-http-proxy');

app.get('/', function (req, res) {
  res.send('Oh, hai!');

app.use('/blog', proxy('my.ip.addr', {
  preserveHostHdr: true,
  forwardPath: function(req, res) {
    console.log('Proxying to ' + req.url)
    return require('url').parse(req.url).path;

app.listen(80, function () {
  console.log('Listening on port 80!');

Using this, I am successfully able to login to the wp-admin panel.

Have another answer? Share your knowledge.