[GeoNode-users] post geoserver proxy ows service and non latin-1 response

Leandro Baroni leandrobaroni at spacesur.com
Wed Dec 2 08:55:10 PST 2020


Greetings everyone!

I am using Geonode version 2.10.3 and Geoserver 2.17.0/Tomcat 9.0.33 in
ubuntu server 18.04.

 I am inserting a new feature through a request to geoserver ows proxy in
geonode (geonode-host/gs/geonode/vector2/ows?, where geonode is the
workspace and vector2 is the layer) using WFS protocol.

First of all, I can insert new features without problems when a user with
correct permissions is used to authenticate the request. The permissions
required to perform the insert are view resource and download resource.
After each request, I receive a 200 status code response and confirm the
insertion by viewing.

When I try to do the same but I use another user without download resource
permission, I receive a 500 status error (Internal Server Error) instead of
40X status error (like unauthorized or not found). Geonode logs reports the
following error:
[wsgi:error] [pid 970:tid 140017990321920] [remote 192.168.10.156:46704]
mod_wsgi (pid=970): Exception occurred processing WSGI script
'/var/www/geoplatform/geonode/wsgi.py'.
[wsgi:error] [pid 970:tid 140017990321920] [remote 192.168.10.156:46704]
Traceback (most recent call last):
[wsgi:error] [pid 970:tid 140017990321920] [remote 192.168.10.156:46704]
File
"/opt/geoplatform/virtualenvs/geoplatform_gn/lib/python3.6/site-packages/django/core/handlers/wsgi.py",
line 170, in __call__
[wsgi:error] [pid 970:tid 140017990321920] [remote 192.168.10.156:46704]
  start_response(status, response_headers)
[wsgi:error] [pid 970:tid 140017990321920] [remote 192.168.10.156:46704]
ValueError: unicode object contains non latin-1 characters

After a lot of prints in django code, I found that the response received by
geonode with status:

404 <!doctype html><html lang="en"><head><title>HTTP Status 404
\xe2\x80\x93 Not Found</title><style type="text/css">body
{font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b
{color:white;background-color:#525D76;} h1 {font-size:22px;} h2
{font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;}
.line
{height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP
Status 404 \xe2\x80\x93 Not Found</h1><hr class="line" /><p><b>Type</b>
Status Report</p><p><b>Description</b> The origin server did not find a
current representation for the target resource or is not willing to
disclose that one exists.</p><hr class="line" /><h3>Apache
Tomcat/9.0.33</h3></body></html>

So, geoserver responds with 404, which is correct, but geonode's django
wsgi can't process the response due to the UTF8 character in the response's
reason.

I could edit the django code to delete the characters \xe2\x80\x93 and the
error was solved, unfortunately, this is not a correct or proper solution.
In addition, the html observed in 404 geoserver response is delivered by
Tomcat.

I tried to change Geoserver and Tomcat charset configuration and set it to
ISO-8859-1 (latin-1) but the response still contains the characters
\xe2\x80\x93. Moreover, these characters seem to be hardcoded into tomcat
error files.

I hope someone can help me with this situation.

Thank you

-- 


Leandro Baroni

Hardware and Software Developer

+54 (11) 4342-2976/84

www.spacesur.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20201202/1456f770/attachment.html>


More information about the geonode-users mailing list