[GeoNode-users] Issues adding WMS URL in GeoNode

Naresh N naresh919 at gmail.com
Fri Jun 16 04:22:42 PDT 2017


Dear Simone,

 I have tried with the url provided http://demo.genode.org/geoserver/wms,
getting the following error.

[image: Inline image 1]

*Please find the apaahe error log file and attached views.py file from
proxy folder of geonode for the reference. In view.py in line no: 37 is
modified (commented host name and placed IP adrdress of GeoNode installed
system)*

[Fri Jun 16 06:16:29.663803 2017] [:error] [pid 14902] Internal Server
Error: /proxy/
[Fri Jun 16 06:16:29.663868 2017] [:error] [pid 14902] Traceback (most
recent call last):
[Fri Jun 16 06:16:29.663873 2017] [:error] [pid 14902]   File
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112,
in get_response
[Fri Jun 16 06:16:29.663876 2017] [:error] [pid 14902]     response =
wrapped_callback(request, *callback_args, **callback_kwargs)
[Fri Jun 16 06:16:29.663878 2017] [:error] [pid 14902]   File
"/data/cms/geonode/geonode/proxy/views.py", line 67, in proxy
[Fri Jun 16 06:16:29.663881 2017] [:error] [pid 14902]
conn.request(request.method, locator, request.body, headers)
[Fri Jun 16 06:16:29.663883 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1017, in request
[Fri Jun 16 06:16:29.663886 2017] [:error] [pid 14902]
self._send_request(method, url, body, headers)
[Fri Jun 16 06:16:29.663888 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1051, in _send_request
[Fri Jun 16 06:16:29.663890 2017] [:error] [pid 14902]
self.endheaders(body)
[Fri Jun 16 06:16:29.663892 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
[Fri Jun 16 06:16:29.663895 2017] [:error] [pid 14902]
self._send_output(message_body)
[Fri Jun 16 06:16:29.663897 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 864, in _send_output
[Fri Jun 16 06:16:29.663899 2017] [:error] [pid 14902]     self.send(msg)
[Fri Jun 16 06:16:29.663901 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 826, in send
[Fri Jun 16 06:16:29.663905 2017] [:error] [pid 14902]     self.connect()
[Fri Jun 16 06:16:29.663907 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 807, in connect
[Fri Jun 16 06:16:29.663909 2017] [:error] [pid 14902]     self.timeout,
self.source_address)
[Fri Jun 16 06:16:29.663911 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/socket.py", line 571, in create_connection
[Fri Jun 16 06:16:29.663914 2017] [:error] [pid 14902]     raise err
[Fri Jun 16 06:16:29.663916 2017] [:error] [pid 14902] error: [Errno 111]
Connection refused
[Fri Jun 16 06:16:29.690555 2017] [:error] [pid 14902] Internal Server
Error: /proxy/
[Fri Jun 16 06:16:29.690580 2017] [:error] [pid 14902] Traceback (most
recent call last):
[Fri Jun 16 06:16:29.690584 2017] [:error] [pid 14902]   File
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 112,
in get_response
[Fri Jun 16 06:16:29.690587 2017] [:error] [pid 14902]     response =
wrapped_callback(request, *callback_args, **callback_kwargs)
[Fri Jun 16 06:16:29.690589 2017] [:error] [pid 14902]   File
"/data/cms/geonode/geonode/proxy/views.py", line 67, in proxy
[Fri Jun 16 06:16:29.690591 2017] [:error] [pid 14902]
conn.request(request.method, locator, request.body, headers)
[Fri Jun 16 06:16:29.690615 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1017, in request
[Fri Jun 16 06:16:29.690621 2017] [:error] [pid 14902]
self._send_request(method, url, body, headers)
[Fri Jun 16 06:16:29.690623 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1051, in _send_request
[Fri Jun 16 06:16:29.690626 2017] [:error] [pid 14902]
self.endheaders(body)
[Fri Jun 16 06:16:29.690628 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
[Fri Jun 16 06:16:29.690630 2017] [:error] [pid 14902]
self._send_output(message_body)
[Fri Jun 16 06:16:29.690632 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 864, in _send_output
[Fri Jun 16 06:16:29.690635 2017] [:error] [pid 14902]     self.send(msg)
[Fri Jun 16 06:16:29.690637 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 826, in send
[Fri Jun 16 06:16:29.690639 2017] [:error] [pid 14902]     self.connect()
[Fri Jun 16 06:16:29.690641 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/httplib.py", line 807, in connect
[Fri Jun 16 06:16:29.690644 2017] [:error] [pid 14902]     self.timeout,
self.source_address)
[Fri Jun 16 06:16:29.690646 2017] [:error] [pid 14902]   File
"/usr/lib64/python2.7/socket.py", line 571, in create_connection
[Fri Jun 16 06:16:29.690648 2017] [:error] [pid 14902]     raise err
[Fri Jun 16 06:16:29.690650 2017] [:error] [pid 14902] error: [Errno 111]
Connection refused
[Fri Jun 16 16:46:32.233785 2017] [:error] [pid 15208] Misconfiguration of
certificate's CN and virtual name. The certificate CN has
localhost4.localdomain4. We expected localhost.localdomain as virtual name.
[Fri Jun 16 16:46:39.030787 2017] [:error] [pid 15135] SSL Library Error:
-12263 SSL received a record that exceeded the maximum permissible length


Please kindly suggest me, do i need to modify some where else?

Thanks,
Naresh


On Thu, Jun 15, 2017 at 2:29 PM, Naresh N <naresh919 at gmail.com> wrote:

> Dear Simone,
>   Thanks. I will try with the provided url.
>
> Thanks,
> Naresh
>
> On Thu, Jun 15, 2017 at 1:17 PM, Simone Dalmasso <
> simone.dalmasso at gmail.com> wrote:
>
>> You can try with http://demo.geonode.org/geoserver/wms. Not sure about
>> our other question, don't think is possible in the standard code.
>>
>> 2017-06-15 9:42 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>
>>> Dear Simone,
>>>   Thanks for the replies. Is any other External WMS Layer url is
>>> available ,please share me to test.  Is that any mechanism is available in
>>> case if WFS of Geoserver is disabled,not enabling EDIT option while reading
>>> error code.
>>>
>>> Thanks,
>>> Naresh
>>>
>>> On Thu, Jun 15, 2017 at 11:50 AM, Simone Dalmasso <
>>> simone.dalmasso at gmail.com> wrote:
>>>
>>>> Ah I see, then is not your or geonode fault. This is an issue of that
>>>> geoserver.
>>>>
>>>> 2017-06-15 8:18 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>>>
>>>>> Dear Simone,
>>>>>   This url  http://bhuvan5.nrsc.gov.in/bhuvan/web/ is external
>>>>> Geoserver of others and I am adding thishttp://bhuvan5.nrsc.gov.in
>>>>> /bhuvan/web/ url to GeoNode using Layers ->Add server option. It is
>>>>> adding but it shows the issue which I mentioned in my earlier mail.
>>>>>
>>>>> Please kindly add the url http://bhuvan5.nrsc.gov.in/bhuvan/wms. in
>>>>> demo GeoNode site  and  can be observed same issue.
>>>>>
>>>>> Thanks,
>>>>> Naresh
>>>>>
>>>>> On Thu, Jun 15, 2017 at 11:39 AM, Simone Dalmasso <
>>>>> simone.dalmasso at gmail.com> wrote:
>>>>>
>>>>>> This says 2.0.2 http://bhuvan5.nrsc.gov.in/bhuvan/web/
>>>>>>
>>>>>> 2017-06-15 8:07 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>>>>>
>>>>>>> Dear Simone,
>>>>>>>
>>>>>>>   Earlier I faced layer issue and with your guidance i  have fixed
>>>>>>> the issue. Please find the link our earlier converstaion
>>>>>>> http://osgeo-org.1560.x6.nabble.com/Layer-Editing-Error-td53
>>>>>>> 23603.html  which contains the steps I followed to install.
>>>>>>>  I have verified my geoserver instance  and version is 2.7.4. Not
>>>>>>> able to understand from where you  observed my Geoserver version is 2.0.2?.
>>>>>>>  Please let me know any other information required to solve the issue
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Naresh
>>>>>>>
>>>>>>> On Thu, Jun 15, 2017 at 11:27 AM, Simone Dalmasso <
>>>>>>> simone.dalmasso at gmail.com> wrote:
>>>>>>>
>>>>>>>> I see that your geoserver is 2.0.2 with 2.4 it should be 2.7.x.
>>>>>>>> Could you clarify how you installed it?
>>>>>>>>
>>>>>>>> 2017-06-15 7:36 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>>>>>>>
>>>>>>>>> Dear Simone,
>>>>>>>>>  Yes, I followed steps from  http://docs.geonode.org/
>>>>>>>>> en/2.4.x/tutorials/install_and_admin/geonode_install/install
>>>>>>>>> _geoserver_application.html  to configure Geoserver with GeoNode
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Naresh
>>>>>>>>>
>>>>>>>>> On Thu, Jun 15, 2017 at 11:01 AM, Simone Dalmasso <
>>>>>>>>> simone.dalmasso at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Have you configured geoserver following the 2.4 guide?
>>>>>>>>>> http://docs.geonode.org/en/2.4.x/tutorials/install_an
>>>>>>>>>> d_admin/geonode_install/install_geoserver_application.html
>>>>>>>>>>
>>>>>>>>>> 2017-06-15 7:27 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>>>>>>>>>
>>>>>>>>>>> Dear simone,
>>>>>>>>>>>  Kindly suggest to overcome the issue.
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Naresh
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Jun 14, 2017 at 5:13 PM, Naresh N <naresh919 at gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Dear Simone,
>>>>>>>>>>>> Copied geoserver.war file from Windows Installation of
>>>>>>>>>>>> GeoNode2.4.x and pasted into /var/lib/tomcats/webapps folder.
>>>>>>>>>>>>
>>>>>>>>>>>> And on demo site of GeoNode (http://demo.geonode.org) also I
>>>>>>>>>>>> have tested with the url http://bhuvan5.nrsc.gov.in/bhuvan/wms
>>>>>>>>>>>> , I am getting same issue. Please help me to resolve
>>>>>>>>>>>>
>>>>>>>>>>>> My System details:
>>>>>>>>>>>> GeoNode 2.4 version
>>>>>>>>>>>> OS: RHEL7.2, 64 bit machine
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Naresh
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Jun 14, 2017 at 4:43 PM, Simone Dalmasso <
>>>>>>>>>>>> simone.dalmasso at gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi seems that you are missing a configuration in geoserver.
>>>>>>>>>>>>> How did you install geonode?
>>>>>>>>>>>>> http://docs.geonode.org/en/master/tutorials/admin/geoserver_
>>>>>>>>>>>>> geonode_security/index.html
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2017-06-14 11:25 GMT+02:00 Naresh N <naresh919 at gmail.com>:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dear All,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>  When I am adding WMS Layer URL in GeoNode  using
>>>>>>>>>>>>>> ADDLayrers---> Addsever option the following error is getting and EDIT
>>>>>>>>>>>>>> options getting enabled.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [image: Inline image 2]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please also find the attached screenshot with this mail. The
>>>>>>>>>>>>>> WMS url  added  is http://bhuvan5.nrsc.gov.in/bhuvan/wms.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Please suggest to solve the issue
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> *Note: Even the url *http://bhuvan5.nrsc.gov.in/bhuvan/wms* tested
>>>>>>>>>>>>>> with GeoNode demo site  and facing similar  issue as above*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>> Naresh
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> geonode-users mailing list
>>>>>>>>>>>>>> geonode-users at lists.osgeo.org
>>>>>>>>>>>>>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Simone
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Simone
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Simone
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Simone
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Simone
>>>>
>>>
>>>
>>
>>
>> --
>> Simone
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170616/207c7e39/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 27704 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170616/207c7e39/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 57124 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170616/207c7e39/attachment-0003.png>
-------------- next part --------------
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################

from django.http import HttpResponse
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlsplit
from django.conf import settings
from django.utils.http import is_safe_url
from django.http.request import validate_host


def proxy(request):
    PROXY_ALLOWED_HOSTS = getattr(settings, 'PROXY_ALLOWED_HOSTS', ())

    host = None

    if 'geonode.geoserver' in settings.INSTALLED_APPS:
        from geonode.geoserver.helpers import ogc_server_settings
        hostname = (ogc_server_settings.hostname,) if ogc_server_settings else ()	
        PROXY_ALLOWED_HOSTS +='192.168.198.209'#hostname	
        host = ogc_server_settings.netloc

    if 'url' not in request.GET:
        return HttpResponse("The proxy service requires a URL-encoded URL as a parameter.",
                            status=400,
                            content_type="text/plain"
                            )

    raw_url = request.GET['url']
    url = urlsplit(raw_url)
    locator = str(url.path)
    if url.query != "":
        locator += '?' + url.query
    if url.fragment != "":
        locator += '#' + url.fragment
   
    
    headers = {}

    if settings.SESSION_COOKIE_NAME in request.COOKIES and is_safe_url(url=raw_url, host=host):
        headers["Cookie"] = request.META["HTTP_COOKIE"]

    if request.method in ("POST", "PUT") and "CONTENT_TYPE" in request.META:
        headers["Content-Type"] = request.META["CONTENT_TYPE"]

    if url.scheme == 'https':
        conn = HTTPSConnection(url.hostname, url.port)
    else:
        conn = HTTPConnection(url.hostname, url.port)
    conn.request(request.method, locator, request.body, headers)

    result = conn.getresponse()

    # If we get a redirect, let's add a useful message.
    if result.status in (301, 302, 303, 307):
        response = HttpResponse(('This proxy does not support redirects. The server in "%s" '
                                 'asked for a redirect to "%s"' % (url, result.getheader('Location'))),
                                status=result.status,
                                content_type=result.getheader("Content-Type", "text/plain")
                                )

        response['Location'] = result.getheader('Location')
    else:
        response = HttpResponse(
            result.read(),
            status=result.status,
            content_type=result.getheader("Content-Type", "text/plain"))

    return response


More information about the geonode-users mailing list