PhilippHeuer / wordpress-heroku

This project is a template for installing and running WordPress 5.x on Heroku.
MIT License
273 stars 316 forks source link

Error when connecting to local WP Admin: Invalid request (Unsupported SSL request) #23

Closed joshiefishbein closed 6 years ago

joshiefishbein commented 6 years ago

Description of your issue

I get this when I navigate to wp-admin on my local: Invalid request (Unsupported SSL request). It looks like it keeps forcing localhost to use https://localhost:3000 when it's hosted on http:// but I don't believe it's my local SSL config because it works for other environments.

Any thoughts?

Steps to Reproduce

Regular install process for development on local machine

PhilippHeuer commented 6 years ago

22 had the same issue as you now and it prob. was a misconfiguration in the .env - so you could check your config.

Im going to try to reproduce this tomorrow to help you. Maybe it's just a error in my wiki.

joshiefishbein commented 6 years ago

Hey @PhilippHeuer !!

Thanks for responding so quickly to this.

Here's my .env just in case you think it might be that:

CUSTOM_DB_URL=mysql://root:root@127.0.0.1:3306/project_name

DB_NAME=project_name
DB_USER=root
DB_PASSWORD=root

# Optional variables
DB_HOST=localhost
DB_PREFIX=escapod_

WP_ENV=development
WP_HOME=http://localhost
WP_SITEURL=${WP_HOME}/wp

# Salts below here

I've also tried messing around with the WP_HOME and WP_SITEURL variable without any luck. I've also turned off these settings in application.php:

define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

And while turning these things to false let me connect successfully with http:// it blocks a few gets/posts that the WP core does on the admin page because of the non-SSL protocol.

Lemme know if you need any other info from to hunt this down. I love WP and I love Heroku, and I haven't ever had any success with any other build package. This is the closest I've gotten to making this relationship work and it's done in such a straightforward way, so anyway I can contribute would be great.

PhilippHeuer commented 6 years ago

I added a check so that FORCE_SSL_LOGIN and FORCE_SSL_LOGIN are only set if the WP_ENV isn't development in the application.php, thx for investigating this on your own.

So make sure you have it set to development.

// Enforce SSL for Login/Admin in production
if(env('WP_ENV') != "development") {
    define('FORCE_SSL_LOGIN', true);
    define('FORCE_SSL_ADMIN', true);
}

Now the command to run wp-cli in the wiki is wrong to start the webserver, to fix enable/disable plugins ... i had to set the path to the real wp directory - which is in turn is breaking the webserver.

Therefore you have to overwrite the path when you run the server using wp-cli to use web directly.

php wp-cli.phar server --host=0.0.0.0 --port=80 --path=web

PhilippHeuer commented 6 years ago

And you only need to set the CUSTOM_DB_URL, you can remove all the DB ENV variables as they get overwritten using the CUSTOM_DB_URL.