Rails heroku app with wordpress as subfolder, unable to log in to admin Rails heroku app with wordpress as subfolder, unable to log in to admin wordpress wordpress

Rails heroku app with wordpress as subfolder, unable to log in to admin


I had this exact problem, and I finally tracked it down to a bug in rack-reverse-proxy. The set-cookie header was being sent in an improper format, so only the first cookie was being interpreted correctly by the browser. That happened to be the wordpress test cookie. All the other (useful) ones were being thrown away, so of course I could not log in.

I plan to submit a bug and branch to rack-reverse-proxy but in the meantime I fixed it with this patch in my config.ru:

class MyReverseProxy < Rack::ReverseProxy  private  def create_response_headers(http_response)    response_headers = super(http_response)    if response_headers      if response_headers["Set-Cookie"].is_a?(Array)        response_headers["Set-Cookie"] = response_headers["Set-Cookie"].join("\n")      end    end    response_headers  endend# this is to make /blog show my wordpress bloguse MyReverseProxy do    reverse_proxy_options :preserve_host => false    reverse_proxy(/^\/blog(\/.*)$/, 'http://your-blog-server.com$1')end


I don't have an answer but I have a few suggestions to get a better understanding of what's going on.

If you are using Google Chrome, open the Network panel of the Developer Tools and watch what happens when you login.

Check to see which domain the cookies are being set for, when you look at the response headers for the POST request that processes your login, you should see Set-Cookie header(s), check whether that domains is .domain.com or blog.domain.com and see if that request is trying to forward you to a different place.

Another possibility is that your Wordpress installation may be configured differently than you want it, for example the site URL being www.domain.com/blog instead of blog.domain.com

Is it possible for you to go to the login page at blog.domain.com/wp-admin/?