Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Control Panel not working correctly on HTTPS #1306

Closed
marconucara opened this issue Mar 8, 2017 · 7 comments
Closed

Control Panel not working correctly on HTTPS #1306

marconucara opened this issue Mar 8, 2017 · 7 comments
Assignees

Comments

@marconucara
Copy link

Expected behaviour

After the go live i switched all site to https. It should work in front end and cp.

Actual behaviour

Front end works, cp can't save pages.

Steps to reproduce

Use https in cp

Server configuration

Operating system:
Amazon linux

Web server:
Apache 2.4

PHP version:
7.0.14

Statamic version:
2.5.4

Updated from an older Statamic or fresh install:
from 2.1

Logs

Console show something like:

Mixed Content: The page at 'https://www.pqeyewear.com/cp/collections/entries/news' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.pqeyewear.com/cp/collections/entries/news/get?sort=datestamp&order=desc&page=1'. This request has been blocked; the content must be served over HTTPS.

This should be very ease to fix, please let me know.

@marconucara marconucara changed the title https destroy cp https destroyed cp Mar 8, 2017
@riasvdv
Copy link

riasvdv commented Mar 8, 2017

Did you change the APP_URL in the .env file? Make sure this references an https url

@marconucara
Copy link
Author

I did not know existed and can not find anything that mention it in the documentation. Anyway I tried it in development and does not work, doesn't change anything.

@riasvdv
Copy link

riasvdv commented Mar 8, 2017

Ah yes that's because I put that setting in an environment file, check if settings --> system -> locales has https in the url

@marconucara
Copy link
Author

Ok I got it. I just did it too, but nothing changes. And I think it is right that the locales settings does not affect the CP url.

@marconucara
Copy link
Author

Ok i figured it out. $_SERVER['HTTPS'] is not set in some environments, you can read about it here and here.

I tryed to fix the file statamic/core/API/URL.php at line 280, but it wasn't enough so i prefered this htaccess work around:

# ------------------------------------------------------------------------------
# $_SEVER['HTTPS'] variable setting
# ------------------------------------------------------------------------------
SetEnv HTTPS on

I still can't fix it in valet share / ngrock environment 'cause it doesn't support htaccess, I could change some core file, probably in bootstrap or similiar but I don't need it so much in development env.

Cheers

@jackmcdade jackmcdade changed the title https destroyed cp Control Panel not working correctly on HTTPS Mar 16, 2017
@jasonvarga
Copy link
Member

In the next release, you can add use_https: true to your system.yaml file to force https urls.

@jackmcdade
Copy link
Member

Closing this one ahead of the release though because it's a duplicate of #1140 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants