Edgewall Software

Ticket #3381 (closed defect: worksforme)

Opened 2 years ago

Last modified 2 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:

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

  Changed 2 years ago by mgood

  • status changed from new to closed
  • resolution set to worksforme

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

follow-up: ↓ 3   Changed 2 years ago by anonymous

  • status changed from closed to reopened
  • version changed from 0.9.5 to 0.10b1
  • resolution worksforme deleted
  • milestone set to 0.10

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 ...

in reply to: ↑ 2   Changed 2 years ago by mgood

  • status changed from reopened to closed
  • resolution set to worksforme
  • milestone 0.10 deleted

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.

  Changed 2 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.

  Changed 2 years ago by cboos

Please follow-up on #2553.

Add/Change #3381 (base_url value in trac.ini seems broken)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.