[GeoNode-devel] Using "/" as SITEURL

Olivier Dalang olivier.dalang at gmail.com
Sun Apr 15 20:00:51 PDT 2018


Hello !

I'm still fighting a little bit with this, as it seems that when running
updateip, layer thumbnails are lost...

It would be much simpler/portable if we could use a relative URL. Besides
the use case already mentioned (several hosts/schemes) I think it's quite
common to setup an instance (including uploading data, styles, thumbnails
etc) before having the final domain name.

The only place where I could understand an absolute URL is if there's such
a thing as main endpoint urls in some metadata.

I'll try to see if this is easy to fix or not (it almost worked in 2.6,
there's a new exception in 2.8).

Francesco can you develop a little bit the relation between SITEURL and
django.contrib.site ? From what I understand, there's no relation between
the two.

Kind regards,

Olivier





On Tue, Mar 20, 2018 at 7:46 PM, francesco bartoli <xbartolone at gmail.com>
wrote:

> Olivier,
>
> you can certainly override the SITEURL variable in a geonode project.
>
> In the sites framework of django that model provides the FQDN
> https://docs.djangoproject.com/en/2.0/ref/contrib/sites/ so it isn't a
> safe design decision.
>
> Francesco
>
> 2018-03-19 9:56 GMT+01:00 Alessio Fabiani <alessio.fabiani at geo-
> solutions.it>:
>
>> Currently is hard to say.
>> The response is, yes, it could be feasible but the whole code should be
>> reviewed in order to catch places where relative urls are not taken into
>> account.
>>
>> As far as I know, for the moment everywhere the assumption is that
>> SITEURL is absolute.
>>
>> Regards,
>>
>> Alessio Fabiani
>>
>> ==
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/it488V for more information.
>> ==
>>
>> Ing. Alessio Fabiani
>>
>> @alfa7691
>> Founder/Technical Lead
>>
>>
>> GeoSolutions S.A.S.
>> Via di Montramito 3/A
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+55054+%C2%A0Massarosa&entry=gmail&source=g>
>> 55054  Massarosa
>> <https://maps.google.com/?q=Via+di+Montramito+3/A+55054+%C2%A0Massarosa&entry=gmail&source=g>
>> (LU)
>> Italy
>> phone: +39 0584 962313 <+39%200584%20962313>
>> fax:     +39 0584 1660272 <+39%200584%20166%200272>
>> mob:   +39 331 6233686 <+39%20331%20623%203686>
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>>
>> -------------------------------------------------------
>>
>> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
>>
>> Le informazioni contenute in questo messaggio di posta elettronica e/o
>> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
>> loro utilizzo è consentito esclusivamente al destinatario del messaggio,
>> per le finalità indicate nel messaggio stesso. Qualora riceviate questo
>> messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
>> darcene notizia via e-mail e di procedere alla distruzione del messaggio
>> stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
>> divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
>> utilizzarlo per finalità diverse, costituisce comportamento contrario ai
>> principi dettati dal D.Lgs. 196/2003.
>>
>> The information in this message and/or attachments, is intended solely
>> for the attention and use of the named addressee(s) and may be confidential
>> or proprietary in nature or covered by the provisions of privacy act
>> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
>> Code).Any use not in accord with its purpose, any disclosure, reproduction,
>> copying, distribution, or either dissemination, either whole or partial, is
>> strictly forbidden except previous formal approval of the named
>> addressee(s). If you are not the intended recipient, please contact
>> immediately the sender by telephone, fax or e-mail and delete the
>> information in this message that has been received in error. The sender
>> does not give any warranty or accept liability as the content, accuracy or
>> completeness of sent messages and accepts no responsibility  for changes
>> made after they were sent or for other risks which arise as a result of
>> e-mail transmission, viruses, etc.
>>
>> 2018-03-16 3:49 GMT+01:00 Olivier Dalang <olivier.dalang at gmail.com>:
>>
>>> Hi !
>>>
>>> When serving one Geonode instance using different host names or schemes
>>> (e.g. LAN/WAN ip, HTTP/HTTPS, multiple domain names), one would have to use
>>> "/" as SITEURL, so that absolute urls refer to the same scheme/domain.
>>>
>>> When doing so, I get the following exception when creating layers
>>> programmatically or running the updatelayers command
>>> :
>>>   File "/usr/local/lib/python2.7/site-packages/geonode/base/models.py",
>>> line 940, in resourcebase_post_save
>>>     if urlsplit(settings.SITEURL).hostname not in link.url:
>>>
>>> It seems it is assumed that SITEURL is an absolute URL including scheme
>>> and host name.
>>>
>>> The bug would be very easy to fix, but since it seems to be assumed
>>> SITEURL must be absolute, I was wondering if there may be some side effects
>>> in using "/" as SITEURL ?
>>>
>>> If there are no side-effects, wouldn't it be good to have "/" as a
>>> default instead of " http://localhost:8000/" ?
>>>
>>> Thanks !
>>>
>>> Olivier
>>>
>>>
>>> _______________________________________________
>>> geonode-devel mailing list
>>> geonode-devel at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/geonode-devel
>>>
>>>
>>
>> _______________________________________________
>> geonode-devel mailing list
>> geonode-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20180416/e0152cab/attachment-0001.html>


More information about the geonode-devel mailing list