Jump to content

websockets from non-ISY server


MarkJames

Recommended Posts

If you're getting 'Connection Reset' to which URL?

 

As an FYI - if the authorization line isn't correct - you will get double prompted for credentials. Since this isn't happening here - this isn't the (immediate) problem.

 

If it's one that doesn't match the ProxyPass lines - it probably means there is a syntax error and Apache isn't listening on the port. Anything is the error files?  What happens if you restart Apache - any errors?

 

Michael.

 

I get connection reset even on local access.  The Raspi is 192.168.0.233 - If I browse to that I get connection reset - diagnostics show connection refused.

 

The difference between homeonthewater.com and www.homeonthewater.com was a leftover dns url forward from when I moved the site from my ReadyNAS to the Raspi.  I've deleted it now but it will take a while for the global DNS cache to update

 

None of the logs in /var/log/apache2 have a timestamp later than 6:25 am today

#sudo service apache2 restart gives me an error 

Job for apache2.service failed.  See systemctl status apache2.service' and 'jornalctl -xn' for details

 

#systemctl status apache2.service gives me

 apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sat 2016-07-02 13:13:01 PDT; 1min 28s ago
  Process: 1390 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Link to comment

Can you send me what your virtual host config was before? (You said that you had backed up the original). Basically, someone is throwing an error, causing Apache to fail completely. You'll need to find out why that's happening from the logs.

 

Michael.

Link to comment

This was my original

 

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com


        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html


        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf


</VirtualHost>


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I edited my previous post but I'll repost it here

#sudo service apache2 restart gives me an error 
Job for apache2.service failed.  See systemctl status apache2.service' and 'journalctl -xn' for details

#systemctl status apache2.service gives me 
apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sat 2016-07-02 13:13:01 PDT; 1min 28s ago
  Process: 1390 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Link to comment

So - Apache is failing to start with the new config in place. You'll need to figure our why - something is missing....

 

With the new config (the one that fails) - what does:

apachectl configtest

reveal?

 

Also - anything in /var/log/syslog when you try to start Apache with the new config ?

 

Michael.

Link to comment
#apachectl configtest 

AH00526: Syntax error on line 14 of /etc/apache2/sites-enabled/000-default.conf:

Invalid command 'AuthGroupFile', perhaps misspelled or defined by a module not included in the server configuration

Action 'configtest' failed.

The Apache error log may have more information.

 

syslog shows the same error information
Link to comment

#sudo a2enmod authz_groupfile 

Considering dependency authz_core for authz_groupfile:
Module authz_core already enabled
Enabling module authz_groupfile.
 
To activate the new configuration, you need to run:
  service apache2 restart
pi@raspberrypi:/var/log $ sudo service apache2 restart
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
pi@raspberrypi:/var/log $
 
#systemctl status apache2.service
 
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sat 2016-07-02 13:35:50 PDT; 8s ago
  Process: 1913 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 2152 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Link to comment
pi@raspberrypi:/var/log $ sudo a2enmod headers

Enabling module headers.

To activate the new configuration, you need to run:

  service apache2 restart

pi@raspberrypi:/var/log $ systemctl status apache2.service

● apache2.service - LSB: Apache2 web server

   Loaded: loaded (/etc/init.d/apache2)

   Active: failed (Result: exit-code) since Sat 2016-07-02 13:35:50 PDT; 3min 23s ago

  Process: 1913 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)

  Process: 2152 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

pi@raspberrypi:/var/log $
Link to comment

 

#apachectl configtest 
AH00526: Syntax error on line 14 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'AuthGroupFile', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
 
syslog shows the same error information

 

Interesting - this passes on my Apache.

 

Just remove the line - it's likely not needed.

 

Michael.

Link to comment

I think I needed headers and authz_groupfile enabled - which I did now.  

 

restarting apache now succeeds!

 

Getting closer...

 

Socket now CONNECTS!  woo hoo!  I owe you a bottle of single malt!

 

REST interface calls do not work - 

http://homeonthewater.com/rest/vars/get/1/45 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

 

mark

Link to comment

I think I needed headers and authz_groupfile enabled - which I did now.  

 

restarting apache now succeeds!

 

Getting closer...

 

Socket now CONNECTS!  woo hoo!  I owe you a bottle of single malt!

 

REST interface calls do not work - 

http://homeonthewater.com/rest/vars/get/1/45 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

 

mark

 

Nice!

 

So - sockets connect - but other rest calls fail. Interesting...

Can you repost the file? (make sure to obfuscate the Authorization header!)

 

Michael.

Link to comment
<VirtualHost *:80>

        ServerAdmin webmaster@homeonthewater.com

        DocumentRoot /var/www/html

 

        ProxyRequests Off

        ProxyPreserveHost On

        KeepAlive On

        KeepAliveTimeout 5000

        ProxyVia Off

        <Proxy *>

                AuthName "Authentication Required"

                AuthType Basic

                AuthUserFile /etc/htpasswd-isy

                AuthGroupFile /dev/null

                require valid-user

               Order deny,allow

                Allow from all

        </Proxy>

        RequestHeader set Authorization "Basic xxxxxxxxxxxxxxxxx"

 

        ProxyPass "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4

        ProxyPassReverse "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4

        ProxyPass /rest http://192.168.0.171/rest

        ProxyPass /services http://192.168.0.171/services

        ProxyPass /WEB http://192.168.0.171/WEB

        ProxyPass /USER http://192.168.0.171/USER

 

        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ErrorLog ${APACHE_LOG_DIR}/error.log

</VirtualHost>
Link to comment

Maybe the newer Apache is needing the ProxyPass attributes to be in quotes (mine does not care)... since only the quoted ones are working....

 

Try replacing:

        ProxyPass /rest http://192.168.0.171/rest
        ProxyPass /services http://192.168.0.171/services
        ProxyPass /WEB http://192.168.0.171/WEB
        ProxyPass /USER http://192.168.0.171/USER

with

        ProxyPass "/rest" "http://192.168.0.171/rest"
        ProxyPass "/services" "http://192.168.0.171/services"
        ProxyPass "/WEB" "http://192.168.0.171/WEB"
        ProxyPass "/USER" "http://192.168.0.171/USER"
Link to comment
<VirtualHost *:80>
        ServerAdmin webmaster@homeonthewater.com
        DocumentRoot /var/www/html


        ProxyRequests Off
        ProxyPreserveHost On
        KeepAlive On
        KeepAliveTimeout 5000
        ProxyVia Off
        <Proxy *>
                AuthName "Authentication Required"
                AuthType Basic
                AuthUserFile /etc/htpasswd-isy
                AuthGroupFile /dev/null
                require valid-user
               Order deny,allow
                Allow from all
        </Proxy>
        RequestHeader set Authorization "Basic xxxxxxxxxxxx"


        ProxyPass "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4
        ProxyPassReverse "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4
        ProxyPass "/rest" "http://192.168.0.171/rest"
        ProxyPass "/services"  "http://192.168.0.171/services"
        ProxyPass "/WEB" "http://192.168.0.171/WEB"
        ProxyPass "/USER" "http://192.168.0.171/USER"


        CustomLog ${APACHE_LOG_DIR}/access.log combined
        ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>

Still not working though - still internal server error 500

Jul  2 14:11:07 raspberrypi systemd[1]: Starting LSB: Apache2 web server...
Jul  2 14:11:07 raspberrypi apache2[3311]: Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directiv$
Jul  2 14:11:08 raspberrypi apache2[3311]: .

I don't think that matters, though.

 

 

 

Apache starts fine - the only message in syslog is about the fqdn asking me to put ServerName directive in - but I don't think that matters.

 

I

Link to comment

I tried putting the rewrite rule back into .htaccess but that didn't help either.

 

You shouldn't need any rewrite rule...  500 is a very generic 'something failed badly' message.

 

Can I confirm that 192.168.0.171 is the IP address of your ISY - that it's HTTP port is 80 and that your 'Authorization' line in the virtual server config file contains the ISY username and password?

 

Can I also confirm that the /etc/htpasswd-isy is the file that contains your 'mark/mark' credential - and that your .htaccess is referencing this same file?

 

If could be that something has changed with Apache 2.4 that I'm not seeing on 2.2.....  Can we try adding in the related ProxyPassReverse lines to see if they are needed now?

        ProxyPass "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4
        ProxyPassReverse "/rest/subscribe" "ws://192.168.0.171/rest/subscribe" retry=4
        ProxyPass "/rest" "http://192.168.0.171/rest"
        ProxyPassReverse "/rest" "http://192.168.0.171/rest"
        ProxyPass "/services" "http://192.168.0.171/services"
        ProxyPassReverse "/services" "http://192.168.0.171/services"
        ProxyPass "/WEB" "http://192.168.0.171/WEB"
        ProxyPassReverse "/WEB" "http://192.168.0.171/WEB"
        ProxyPass "/USER" "http://192.168.0.171/USER"
        ProxyPassReverse "/USER" "http://192.168.0.171/USER"

Michael.

Link to comment

Yes - that's all correct.

 

The error log reads as follows

 

[sat Jul 02 14:57:49.343951 2016] [proxy:warn] [pid 646] [client 192.168.0.1:53965] AH01144: No protocol handler was valid for the URL /rest/elk/get/status. If you are using a DSO version of mod_proxy, make $
[sat Jul 02 14:57:49.351229 2016] [proxy:warn] [pid 640] [client 192.168.0.1:53970] AH01144: No protocol handler was valid for the URL /rest/elk/get/status. If you are using a DSO version of mod_proxy, make $
[sat Jul 02 14:57:52.322729 2016] [proxy:warn] [pid 645] [client 192.168.0.1:53971] AH01144: No protocol handler was valid for the URL /rest/elk/get/status. If you are using a DSO version of mod_proxy, make $
[sat Jul 02 14:57:52.331430 2016] [proxy:warn] [pid 642] [client 192.168.0.1:53972] AH01144: No protocol handler was valid for the URL /rest/elk/get/status. If you are using a DSO version of mod_proxy, make $
[sat Jul 02 14:57:52.566785 2016] [proxy:warn] [pid 646] [client 192.168.0.1:57505] AH01144: No protocol handler was valid for the URL /rest/status/7 2F 2F 1. If you are using a DSO version of mod_proxy,
 
and so on...
Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...