Tryton-server sao reverse prox apache https

Hello i finally succeded in installing tryton-server ans sao,. I can access it from the web on 8000.

I tried to use apache 2.4 as a reverse proxy and it work… well…

i can log in and do things. BUT in the logs of trytond

i have

saisissez ou collez du code iciMon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET / HTTP/1.1" 200 -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /bower_components/jquery/dist/jquery.min.js HTTP/1.1" 200 -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] 
[...]
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /dist/tryton-sao.min.css HTTP/1.1" 200 -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /custom.js HTTP/1.1" **405** -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /custom.css HTTP/1.1" **405** -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /custom.js HTTP/1.1" 405 -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "GET /custom.css HTTP/1.1" 405 -
Mon Nov 04 13:47:32 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:32] "POST / HTTP/1.1" 200 -

with an OLD firefox (68)

if i try with a “new” one i do not have access and the logs are

Mon Nov 04 13:47:48 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:48] "GET / HTTP/1.1" 200 -
Mon Nov 04 13:47:48 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:48] "GET /custom.js HTTP/1.1" 405 -
Mon Nov 04 13:47:48 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:48] "GET /custom.css HTTP/1.1" 405 -
Mon Nov 04 13:47:49 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:49] "GET /custom.js HTTP/1.1" 405 -
Mon Nov 04 13:47:49 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:49] "GET /custom.css HTTP/1.1" 405 -
Mon Nov 04 13:47:49 2024] INFO:werkzeug:127.0.0.1 - - [04/Nov/2024 13:47:49] "POST / HTTP/1.1" 500 -
Mon Nov 04 13:47:49 2024] ERROR:werkzeug:Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 335, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 322, in execute
    application_iter = app(environ, start_response)

ma conf trytond est “normale”

et mon site.conf de apache est cela

  GNU nano 7.2                                                                              /etc/apache2/sites-enabled/erp_delatour-le-ssl.conf                                                                                       
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName erp-mon-site.com
        DocumentRoot /var/www/mon-site

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/mon-site_access.log combined

        ServerSignature Off
        RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
        RequestHeader set X-Forwarded-Proto "https"
        Header always set Access-Control-Allow-Origin “*”

        SSLProxyEngine On
        SSLProxyVerify none
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off

        ProxyRequests Off
        ProxyPreserveHost Off

        SetEnvIf X-Requested-With "XMLHttpRequest" xhr_request
        RequestHeader set Host 127.0.0.1 env=xhr_request

        ProxyPass / http://127.0.0.1:8000/
        ProxyPassReverse / http://127.0.0.1:8000/

        RewriteEngine on

        # Support WebSocket
        RewriteCond %{HTTP:Upgrade} =websocket [NC]
        RewriteRule /(.*) wss://127.0.0.1:8000/$1 [P,L]


        <Location />
        SubstituteMaxLineLength 10M
        AddOutputFilterByType SUBSTITUTE text/html text/css text/javascript application/javascript application/json
        Substitute "s|http://127.0.0.1:8000|https://erp-mon-site.com|ni"

        # Autoriser toutes les méthodes HTTP
        <Limit GET POST PUT DELETE PATCH OPTIONS>
            Require all granted
        </Limit>
    </Location>

        ProxyPassReverseCookieDomain 127.0.0.1 erp-mon-site.com
        ProxyPassReverseCookiePath / /


Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/.......
SSLCertificateKeyFile /etc/letsencrypt/live/......
</VirtualHost>
</IfModule>

It is normall that you get such errors. custom files are optional and only used for loading custom code or styles on web client. So I do not think you should worry about them.

my main problems is that i have that

Mon Nov 04 13:47:49 2024] ERROR:werkzeug:Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 335, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 322, in execute
    application_iter = app(environ, start_response)

and

werkzeug.exceptions.Forbidden: 403 Forbidden: You don’t have the permission to access the requested resource. It is either read-protected or not readable by the server.

Did you configured the proper number of proxies?

i do not even know it was possible.

where can i find some doc or tutorial about it ?

i think that tryton-sao with apache reverse proxy in https seems to me to be a common use . i do not know where to search

your link show me some hints, i will try…

that was it

cors = https://mon-site.com

in the web sqection of /etc/tryton/trytond.con

\O/

thanks a lot

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.