Hi,
taskd makes a "Request" object and runs it through a turbogears wsgi app.
This is so that all code can use variables like app_globals (g), tmpl_context
(c), request, etc whether the code runs in a web request or a task. This
starts here:
r = Request.blank(request_path,
base_url=tg.config['base_url'].rstrip(
'/') + request_path,
environ={'task': self.task,
'nocapture': self.options.nocapture,
})
list(wsgi_app(r.environ, start_response))
And `wsgi_app` ends up using the `[app:task]` section from your `.ini` file,
which is probably like this:
```
[app:task]
use = main
; TurboGears will use controllers/task.py as root controller
override_root = task
```
So task.py's `TaskController` is what is supposed to finally run the task.
I haven't tried the proxy-prefix, so I'm not real sure what its implications
are. But I would try putting logging in `TaskController.__call__` to see if
its executing at all. Probably not. The log output with the 404 error means
that its not finding the TaskController.
My guess is the `/my-site` prefix is extra or missing, when running tasks. So
some ideas you could try:
- prepend `/my-site` to `base_url` in the `Request.blank` object. Or remove it
if its already part of the base_url
- add the filter-with to the `[app:task]` section too. Or remove it if you
have it there already
- do some debugging in `def make_app` where it handles the `override_root`
setting and make sure its finding and loading `TaskController` as the root
---
** [tickets:#8395] Context root URL change **
**Status:** open
**Milestone:** unreleased
**Created:** Mon Aug 23, 2021 05:04 PM UTC by Vrinda A
**Last Updated:** Mon Aug 23, 2021 05:04 PM UTC
**Owner:** nobody
I have a requirement to change the context root URL of Allura. With the hint
from a TurboGears
[forum](https://groups.google.com/g/turbogears/c/TzBTef09q8U/m/YpkrlfaInB4J), I
could change the context root URL by making this change in development.ini
[filter:proxy-prefix]
use = egg:PasteDeploy#prefix
prefix = /my-site
[app:main]
use = egg:Allura
full_stack = true
filter-with = proxy-prefix
With this change, all the Allura pages go through http://localhost:8080/my-site.
But the issue is that taskd tasks don't work anymore. Allura.log shows up this
warning:
16:23:25,927 WARNI
[taskd:forgetracker.tasks.update_bin_counts:61237e1fe992b56fe76a7387:allura.command.taskd]
Unexpected http response from taskd request: 404 Not Found. Headers:
[('Cache-Control', 'no-cache'), ('Pragma', 'no-cache'), ('Content-Type',
'text/html; charset=utf-8'), ('Content-Length', '4448'), ('Set-cookie',
'_session_id=b03d71ba8fd1fdb753e1582f86a4260a7d5f5ce613411d1012cd6e51ebd4dae0191bd6adb0f879b7;
Path=/')]
Any pointers on how to make taskd aware of the context root url change?
---
Sent from forge-allura.apache.org because [email protected] is subscribed
to https://forge-allura.apache.org/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is
a mailing list, you can unsubscribe from the mailing list.