[Trac] Redirect URL of internal WSGI server for Trac 1.2.4 doesn't work

2019-09-25 Thread Viktor Chernov
Hi! 

I need help with URL redirects for Trac with WSGI script. I have httpd 
server behind AWS ALB. I'm terminating SSL on ALB side and then response 
goes to httpd on port 80.
We recently migrated from Trac 0.12 to 1.2.4 and faced with changed URL 
addresses. And for backward compatibility, we are trying to rewrite 
responses from  ^/trac/project$  to /trac/browser/project. But for some 
reason, it doesn't work.

I always get the same error:
2019-09-25 04:07:22,061 Trac[main] WARNING: HTTPNotFound: 404 Not Found (No 
handler matched request to /project), , 
referrer None

Here is the configuration:
# Security
ServerTokens Prod
ServerSignature Off
TraceEnable Off

ServerName "my.domain.com"
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 15
LimitRequestFieldSize 8190
LimitRequestFields 100

User apache
Group apache

AccessFileName .htaccess

Require all denied



  Options FollowSymLinks
  AllowOverride None


HostnameLookups Off
ErrorLog "/var/log/httpd/error_log"
LogLevel warn
EnableSendfile On
#Listen 80

Include "/etc/httpd/conf.d/modules/*.load"
Include "/etc/httpd/conf.d/modules/*.conf"
Include "/etc/httpd/conf/ports.conf"

LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
combined
LogFormat "%a %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" 
\"%{User-agent}i\"" forwarded

IncludeOptional "/etc/httpd/conf.d/*.conf"

I have enabled mod_rewrite
httpd -M | grep rewrite_module 
rewrite_module (shared)

My trac.wsgi file
import os

# The TRAC_ENV variable should naturally be the directory for your Trac 
environment, 
# and the PYTHON_EGG_CACHE should be a directory where Python can 
temporarily extract Python eggs. 
# If you have several Trac environments in a directory, you can also use 
TRAC_ENV_PARENT_DIR instead of TRAC_ENV.

os.environ['TRAC_ENV'] = '/var/trac/project'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'

import trac.web.main
application = trac.web.main.dispatch_request

My Trac httpd conf
RewriteEngine On
RewriteRule ^/trac/project/changeset/1755$ /trac/changeset/1755/project [QSA
,PT,L]
RewriteRule ^/trac/project/$ /trac/browser/project [R]

WSGIRestrictStdout Off
WSGIPythonOptimize 0
WSGIScriptAlias /trac var/www/trac/project/cgi-bin/trac.wsgi


WSGIApplicationGroup %{GLOBAL}
AllowOverride All
Options ExecCGI Indexes FollowSymLinks MultiViews
Require all granted
   # Order deny,allow
   # Allow from all

# 
# Virtual directory to browse subversion in Trac
#

AuthType Basic
AuthName "Trac Login"
AuthUserFile /var/access/passwd
Require valid-user


Can you help me to understand what is wrong?

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/1df60fa4-0e16-4a78-8e8f-5e102e046be0%40googlegroups.com.


[Trac] Redirect URL of internal WSGI server for Trac 1.2.4 doesn't work

2019-09-25 Thread Viktor Chernov
Hi! 

I need help with URL redirects for Trac with WSGI script. I have httpd 
server behind AWS ALB. I'm terminating SSL on ALB side and then response 
goes to httpd on port 80.
We recently migrated from Trac 0.12 to 1.2.4 and faced with changed URL 
addresses. And for backward compatibility, we are trying to rewrite 
responses from  ^/trac/project$  to /trac/browser/project. But for some 
reason, it doesn't work.

I always get the same error:
2019-09-25 04:07:22,061 Trac[main] WARNING: HTTPNotFound: 404 Not Found (No 
handler matched request to /project), , 
referrer None

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/7fde3d61-8a12-4537-a4cd-3527a0190ef0%40googlegroups.com.