Edgewall Software
Modify

Ticket #3381 (closed defect: worksforme)

Opened 6 years ago

Last modified 5 years ago

base_url value in trac.ini seems broken

Reported by: cies.breijs@… Owned by: jonas
Priority: normal Milestone:
Component: web frontend/tracd Version: 0.10b1
Severity: normal Keywords:
Cc:
Release Notes:
API Changes:

Description

maybe i'm wrong but the base_url value seems to be ignored after i've set it.

I want to have my trac wiki on https://someurl/trac/project/wiki

so i set the base_url to

https://someurl/trac/

i run my tracd with

/usr/bin/python /usr/bin/tracd -d --port 8000 -e /var/trac

and i have the following somewhere in my apache2 conf files:

ProxyPass /trac balancer://trac_cluster/

ProxyPassReverse /trac balancer://trac_cluster/

but non of the links get prefixed with this url...

i want apache to take care of the SSL and auth'ion stuff (apache doesn't seems to be the issue here)

Attachments

Change History

comment:1 Changed 6 years ago by mgood

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

Where are you looking for base_url to appear? It's only used when Trac needs to generate absolute URLs, such as in the RSS feeds. Otherwise Trac uses server-relative links.

In order to use tracd through a proxy with a base URL other than "/" you'll need to upgrade to 0.10 (currently in the trunk) and use the --base-path option for tracd to properly parse the URLs coming from the proxy:

tracd -d -p 8000 --base-path=/trac -e /var/trac

comment:2 follow-up: Changed 5 years ago by anonymous

  • Milestone set to 0.10
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version changed from 0.9.5 to 0.10b1

Why are the urls anyway absolute, why not use relative paths and try not to fix the problems caused by absolute paths with glue (base_url, base-path).

Anyway, the --base-path does not work either, if I enable it and try access the server I always get the project listing, even when not using trac trough proxy. I can see it requests /trac/project fine (even correct path) but it still returns project list ...

comment:3 in reply to: ↑ 2 Changed 5 years ago by mgood

  • Milestone 0.10 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

Replying to anonymous:

Why are the urls anyway absolute, why not use relative paths and try not to fix the problems caused by absolute paths with glue (base_url, base-path).

Relative URLs are used in the Trac HTML pages when possible, but RSS feeds and emails need to use absolute URLs.

Anyway, the --base-path does not work either, if I enable it and try access the server I always get the project listing, even when not using trac trough proxy. I can see it requests /trac/project fine (even correct path) but it still returns project list ...

Please ask for help on the MailingList. Be sure to provide the tracd commandline and your configuration for the proxy.

comment:4 Changed 5 years ago by eposthumus@…

I have a similar problem, but have traced the issue to the way relative URLs are re-contructed in source:/trunk/trac/web/api.py@4254#271

In there self.scheme is used, which comes from the wsgi request, and not from the base_url. So if you have a different scheme in your request, which happens when you are proxying behind Apache, the re-direct will seem to fail.

My solution is to temporarily hack in a hard-coded scheme in the source of the installation that I am using, but a more correct solution is obviously the better route.

comment:5 Changed 5 years ago by cboos

Please follow-up on #2553.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.