emoncms (https and redirection)

Hello everybody,

I have just updated my emoncms to the version 5. Everything is ok when using emoncms with http. When trying to use it through https, I have the login page but login failed with an empty red box. On the previous version, it worked fine

Thank you in advance for your help.

Paul Reed's picture

Re: emoncms (https and redirection)

Hi Nicolas

To get back working, do the following;

$ sudo nano /var/www/emoncms/settings.php

and paste the code attached below, just above the entry;

// Default controller and action if none are specified and user is anonymous

Save the settings.php and reboot.

Jérôme's picture

Re: emoncms (https and redirection)

I believe this should not be necessary with latest revisions.

Paul Reed's picture

Re: emoncms (https and redirection)

Jérôme, I presume that Nicolas was using the last but one commit, which made the changes to the route in default.settings.php

The file was changed again about a week later, to ensure that emoncms upgraded seamlessly from previous versions.

I guess that if he did a fresh git pull, the current version would now correct the problem.

Paul

Jérôme's picture

Re: emoncms (https and redirection)

Yes, I think so.

I was mentioning this to avoid anyone with the same symptoms in the future bothering with settings.php edition.

nicolashahang's picture

Re: emoncms (https and redirection)

Hello,

First, thank you very much for your support. I have tested your fix but it does not work. I forget to tell you how I connect with https. I access with a url like this : https://emoncms.mydomain.com/. I don't use the subfolder emoncms. Is it a bad idea ?

Is it possible to use emoncms with this url ?

 

Thank you in advance.

Nicolas HAHANG

Jérôme's picture

Re: emoncms (https and redirection)

Hi.

Sorry, I replied to Paul's reply but overlooked your initial message.

It never worked on my own server with https but this is due to my own apache config. And it does not seem to work on my Pi with latest version, but this could have many reasons. I'm afraid I can't help.

Mattia Rossi's picture

Re: emoncms (https and redirection)

Hi Nicolas, in order to be of some help you should post the virtual host (or default) config you are using, both for http and https.

After that you should try and perform the login in chrome with the developer window open on the network tab, and post the result of the ajax call that is being made when you press the login button (firefox andd firebug will work as well)

 

One thing you could try in the meantime is setting the $path variable to "/" in index.php, but I'm not sure it will be used when processing ajax calls (actually I'm pretty sure it won't but setting it won't hurt and will make all the ajax calls work as well)

 

Regards

nicolashahang's picture

Re: emoncms (https and redirection)

Hello,

This is my virtual host config https:

<VirtualHost 192.168.1.8:443>
DocumentRoot "/share/Web/emoncms"
ServerName emoncms.mydomain.name
SSLEngine on
SSLCipherSuite ALL:!SSLv2:!LOW:!EXPORT40:@STRENGTH
SSLCertificateFile "/etc/stunnel/stunnel.pem"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/usr/local/apache/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog "/usr/local/apache/logs/ssl_request_log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

        SSLProxyEngine on
        SSLVerifyClient require
        SSLVerifyDepth 1
        SSLCACertificateFile /share/MD0_DATA/Private/ca.crt

</VirtualHost>
 

for http :

<VirtualHost _default_:80>
        DocumentRoot "/share/Web"
</VirtualHost>
 

 

I have the following response in the developper window in chrome :

login.json (/user)

  1. Request URL:
    https://emoncms.mydomain.name/user/login.json
  2. Request Method:
    POST
  3. Status Code:

    200 OK
  4. Request Headersview source

    1. Accept:
      application/json, text/javascript, */*; q=0.01
    2. Accept-Encoding:
      gzip,deflate,sdch
    3. Accept-Language:
      fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
    4. Connection:
      keep-alive
    5. Content-Length:
      54
    6. Content-Type:
      application/x-www-form-urlencoded; charset=UTF-8
    7. Cookie:
      PHPSESSID=xxxxxxxxxxxxxxxxxxxxxxxxxx
    8. Host:
      emoncms.mydomain.name
    9. Origin:
      https://emoncms.mydomain.name
    10. Referer:
      https://emoncms.mydomain.name/
    11. User-Agent:
      Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
    12. X-Requested-With:
      XMLHttpRequest
  5. Form Dataview sourceview URL encoded

    1. :
    2. username:
      myusername
    3. password:
      mypassword
    4. rememberme:
      0
  6. Response Headersview source

    1. Cache-Control:
      no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    2. Connection:
      Keep-Alive
    3. Content-Length:
      2
    4. Content-Type:
      text/html
    5. Date:
      Fri, 24 May 2013 09:18:43 GMT
    6. Expires:
      Thu, 19 Nov 1981 08:52:00 GMT
    7. Keep-Alive:
      timeout=15, max=100
    8. Pragma:
      no-cache
    9. Server:
      Apache
    10. X-Powered-By:
      PHP/5.3.14

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.