Ticket #1031 (closed Defect: worksforme)

Opened 5 years ago

Last modified 5 years ago

dm4.host.url settings ignored in webclient

Reported by: JuergeN Owned by: jri
Priority: Blocker Milestone: Release 4.8.4
Component: DeepaMehta Standard Distribution Version: 4.8.3
Keywords: Cc: Malte
Complexity: 3 Area: Runtime Environment
Module:

Description

I want to run DM on a public website and reach the webclient over '/edit/' URL.
In the config file I set

dm4.host.url = https://gamechangers.aalto.fi/edit/

but the browser shows gives me these error messages:

Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/model/topic_type.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/model/association_type.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/interfaces/topicmap_renderer.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/renderers/topicmap_renderers/canvas_renderer.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/renderers/topicmap_renderers/canvas_view.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/gui/split_panel.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/gui/toolbar_panel.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/gui/page_panel.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/plugin_manager.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/webclient.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/renderers/page_renderers/page_model/page_model.js Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/script/vendor/jquery/css/custom-theme/jquery-ui-1.10.3.custom.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/css/webclient.css Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/css/jquery-ui-overrides.css Failed to load resource: the server responded with a status of 404 (Not Found)
https://gamechangers.aalto.fi/de.deepamehta.webclient/css/ckeditor-overrides.css Failed to load resource: the server responded with a status of 404 (Not Found)

So it seemsm, that the webclient is ignoring the dm4.host.url setting.

Change History

comment:1 Changed 5 years ago by jri

The Webclient (actually the entire standard distro) does not evaluate dm4.host.url in any way. This setting is only used by 3rd-party modules (e.g. dm4-images) when it comes to construct public URLs. Where a plugin's static resources are served depends solely on its bundle-symbolic-name (e.g. de.deepamehta.webclient). So, I guess your proxy has a problem here.

comment:2 Changed 5 years ago by Malte

So, I guess your proxy has a problem here.

I think Juergen aim is to proxy the root resource of deepamehta not at "/" but at "/edit/, which does not work yet for the dm4-webclient. The error messages suggest to me that the webclient currently always tries to resolve its assets (and for e.g the /core/ endpoint) directly at the web servers root resource, which is non-existent if the proxy setup is what i think it is (:80/edit/ == :8080/)

At our meeting at the Cafe in later summer i told you two that it would be nice if one could switch DM's root resource to be a subresource, as it is currently not possible. One of you then suggested to introduce an additional config option with which we can specify the name or path of the sub-resource the dm4-webclient should resolve to and in this case that option would then need to be set to "/edit/".

comment:3 Changed 5 years ago by JuergeN

Yes, Malte got it right. I want to reach DeepaMehta not from the root but from www.server.tld/edit/...

comment:4 Changed 5 years ago by JuergeN

OK. So here is how I solved the problem:

<VirtualHost *:443>
    
    ServerName gamechangers.aalto.fi
    ServerAdmin postmaster@digitalmemex.com
    DefaultType text/html

    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/gamechangers.aalto.fi/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/gamechangers.aalto.fi/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/gamechangers.aalto.fi/chain.pem

    ErrorLog /var/log/apache2/deepamehta-ssl-error.log
    CustomLog /var/log/apache2/deepamehta-ssl-access.log combined
    
    RewriteEngine On 

    ## favicon.ico ##
    RewriteCond %{REQUEST_URI} "^/favicon.ico$"
    RewriteRule ^(.*) http://localhost:8080/de.deepamehta.webclient/images/deepamehta-favicon.png [P]

    ## rewrite root to timeline ##
    RewriteCond %{REQUEST_URI} "^/$" [OR]
    RewriteCond %{REQUEST_URI} "^/img/(.*)" [OR]
    RewriteCond %{REQUEST_URI} "^/css/(.*)" [OR]
    RewriteCond %{REQUEST_URI} "^/js/(.*)"
    RewriteRule ^(.*) http://localhost:8080/fi.aalto.gamechangers/$1 [P]
    
    ## rewrite sign-up ##
    RewriteCond %{REQUEST_URI} "^/sign-up$" [OR]
    RewriteCond %{REQUEST_URI} "^/sign-up/$"
    RewriteRule ^/sign-up(.*)$ http://localhost:8080/sign-up/ [P]

    ## rewrite login ##
    RewriteCond %{REQUEST_URI} "^/login(.*)$"
    RewriteCond %{REQUEST_URI} "^/sign-up/login(.*)$"
    RewriteRule ^/(sign-up/login|login)(.*)$ http://localhost:8080/sign-up/login [P]

    ## rewrite edit ##
    RewriteCond %{REQUEST_URI} "^/edit(.*)$"
    RewriteRule ^/edit(.*)$ http://localhost:8080/de.deepamehta.webclient [P]

    ProxyStatus On
    ProxyPreserveHost Off
    AllowEncodedSlashes NoDecode
    
    <Proxy *>
	Order deny,allow
        Allow from all
    </Proxy>
    
    <location />
        Order allow,deny
        Allow from all
        ProxyPass http://localhost:8080/ nocanon
        ProxyPassReverse http://localhost:8080/
    </location>

</VirtualHost>

Everyone seems to be happy now. The Timeline WebApp? can be accessed from the main URL. The rewrite is not visible to the browser (client) - the URL in the browser stays 'nice' as it does not show the internal URL. All the rest is working as desired, too.

Last edited 5 years ago by JuergeN (previous) (diff)

comment:5 Changed 5 years ago by JuergeN

  • Status changed from new to closed
  • Resolution set to worksforme

comment:6 Changed 5 years ago by jri

Very good!
:-)

Note: See TracTickets for help on using tickets.