Problem with redirection when entering alias without a / at the end
Hey there,
I'm using Apache2 as the webserver, configured https://mailman.xyz.de as Web host.
When I want to get to Mailman Starting Page now I need to Enter the following URL: https://mailman.xyz.de/mailman3/ to be directly redirected as expected to https://mailman.xyz.de/mailman3/postorius/lists/ -> works.
Problem: When leave out the slash at the end and I ONLY enter the following URL: https://mailman.xyz.de/mailman3 -> then I'm wrongly redirected to a page, taht does not exist: https://mailman.xyz.de/mailman/postorius/lists/ -> 404
Where can I change this misbehaviour? In Apache-conf everything seems as it'S in the docs, for the vHost I do not have any other custom settings.
Thank you in advance.
By the way: Is there an easy way to redirect directly from https://mailman.xyz.de to https://mailman.xyz.de/mailman3/postorius/lists/ -> what would be a possibility for that?
On 3/19/21 2:55 PM, Jens Günther wrote:
When I want to get to Mailman Starting Page now I need to Enter the following URL: https://mailman.xyz.de/mailman3/ to be directly redirected as expected to https://mailman.xyz.de/mailman3/postorius/lists/ -> works.
Problem: When leave out the slash at the end and I ONLY enter the following URL: https://mailman.xyz.de/mailman3 -> then I'm wrongly redirected to a page, taht does not exist: https://mailman.xyz.de/mailman/postorius/lists/ -> 404
Huh? that is the same URL as the one above that you say works. Do you mean https://mailman.xyz.de/mailman/postorius/lists without the slash or what.
Where can I change this misbehaviour? In Apache-conf everything seems as it'S in the docs, for the vHost I do not have any other custom settings.
What is the exact content of your RedirectMatch or ReweriteRule or whatebver you are using?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Am 19.03.21 um 23:04 schrieb Mark Sapiro:
On 3/19/21 2:55 PM, Jens Günther wrote:
When I want to get to Mailman Starting Page now I need to Enter the following URL: https://mailman.xyz.de/mailman3/ to be directly redirected as expected to https://mailman.xyz.de/mailman3/postorius/lists/ -> works.
Problem: When leave out the slash at the end and I ONLY enter the following URL: https://mailman.xyz.de/mailman3 -> then I'm wrongly redirected to a page, taht does not exist: https://mailman.xyz.de/mailman/postorius/lists/ -> 404
Huh? that is the same URL as the one above that you say works. Do you mean https://mailman.xyz.de/mailman/postorius/lists without the slash or what.
Here is the difference: https://mailman.xyz.de/mailman3/ https://mailman.xyz.de/mailman3
-> the first one works and leeds to https://mailman.xyz.de/mailman3/postorius/lists -> the second one redirects to https://mailman.xyz.de/mailman/postorius/lists -> which does not exist, since Apache-alias is only for mailman3
Where can I change this misbehaviour? In Apache-conf everything seems as it's in the docs, for the vHost I do not have any other custom settings.
What is the exact content of your RedirectMatch or ReweriteRule or whatebver you are using?
I only use the apache-conf given in the documentation:
<code> Alias /mailman3/favicon.ico /var/lib/mailman3/web/static/postorius/img/favicon.ico Alias /mailman3/static /var/lib/mailman3/web/static
<Directory "/var/lib/mailman3/web/static"> Require all granted </Directory>
<IfModule mod_proxy_uwsgi.c> ProxyPass /mailman3/favicon.ico ! ProxyPass /mailman3/static ! ProxyPass /mailman3 unix:/run/mailman3-web/uwsgi.sock|uwsgi://localhost/ </IfModule> </code>
On 3/19/21 3:12 PM, Jens Günther wrote:
-> the first one works and leeds to https://mailman.xyz.de/mailman3/postorius/lists -> the second one redirects to https://mailman.xyz.de/mailman/postorius/lists -> which does not exist, since Apache-alias is only for mailman3
Sorry, I missed that it was mailman vs mailman3.
I only use the apache-conf given in the documentation:
<code> Alias /mailman3/favicon.ico /var/lib/mailman3/web/static/postorius/img/favicon.ico Alias /mailman3/static /var/lib/mailman3/web/static
<Directory "/var/lib/mailman3/web/static"> Require all granted </Directory>
<IfModule mod_proxy_uwsgi.c> ProxyPass /mailman3/favicon.ico ! ProxyPass /mailman3/static ! ProxyPass /mailman3 unix:/run/mailman3-web/uwsgi.sock|uwsgi://localhost/ </IfModule> </code>
I don't use uwsgi so I can't advise on its configuration, but do you have
USE_X_FORWARDED_HOST = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
in your Django settings?
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
I did have the first setting, yes.
The second one no, but activated it now, no change.
Am 20.03.21 um 00:00 schrieb Mark Sapiro:
I don't use uwsgi so I can't advise on its configuration, but do you have
USE_X_FORWARDED_HOST = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
in your Django settings?
On 3/19/21 4:10 PM, Jens Günther wrote:
I did have the first setting, yes.
The second one no, but activated it now, no change.
I suspect this issue has something to do with the uwsgi configuration, but I'm sorry that I can't help with that as I have no experience with uwsgi - I've only used gunicorn and Apache mod_wsgi.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Mar 19, 2021, at 4:10 PM, Jens Günther <jens.guenther@posteo.de> wrote:
I did have the first setting, yes.
The second one no, but activated it now, no change.
Can you also share your uwsgi configuration?
Am 20.03.21 um 00:00 schrieb Mark Sapiro:
I don't use uwsgi so I can't advise on its configuration, but do you have USE_X_FORWARDED_HOST = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') in your Django settings?
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
Sure. It's not much, when I get it right, file was created by debian-package automatically (I only post the lines without #):
->/etc/mailman3/uwsgi.ini
[uwsgi] uwsgi-socket = /run/mailman3-web/uwsgi.sock enable-threads = true chdir = /usr/share/mailman3-web wsgi-file = wsgi.py master = true process = 2 threads = 2 uid = www-data gid = www-data plugins = python3 attach-daemon = python3 manage.py qcluster logto = /var/log/mailman3/web/mailman-web.log
Am 20.03.21 um 00:28 schrieb Abhilash Raj:
Can you also share your uwsgi configuration?
On 3/19/21 4:53 PM, Jens Günther wrote:
Sure. It's not much, when I get it right, file was created by debian-package automatically (I only post the lines without #):
->/etc/mailman3/uwsgi.ini
[uwsgi] uwsgi-socket = /run/mailman3-web/uwsgi.sock enable-threads = true chdir = /usr/share/mailman3-web wsgi-file = wsgi.py master = true process = 2 threads = 2 uid = www-data gid = www-data plugins = python3 attach-daemon = python3 manage.py qcluster logto = /var/log/mailman3/web/mailman-web.log
Am 20.03.21 um 00:28 schrieb Abhilash Raj:
Can you also share your uwsgi configuration?
How about the actual uwsgi config. Maybe something like /etc/uwsgi.ini
See https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mh, actually I don't know, what you mean. I only do have one config-file and that's the one I posted :-(
((Probably I should update the suite to 3.3.3 before continuing to figure out what's wrong. I just thought before installing everything to run with the stable one provided by Debian, seems that it wasn't the best idea :-) ))
Am 20.03.21 um 02:25 schrieb Mark Sapiro:
How about the actual uwsgi config. Maybe something like /etc/uwsgi.ini
See https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html
On 3/20/21 1:38 AM, Jens Günther wrote:
Mh, actually I don't know, what you mean. I only do have one config-file and that's the one I posted :-(
I'm sorry, that was my confusion. I see now that the file you posted is what we are looking for. What's in the wsgi.py file referenced in that config? That may help.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On Mar 19, 2021, at 4:53 PM, Jens Günther <jens.guenther@posteo.de> wrote:
Sure. It's not much, when I get it right, file was created by debian-package automatically (I only post the lines without #):
->/etc/mailman3/uwsgi.ini
[uwsgi] uwsgi-socket = /run/mailman3-web/uwsgi.sock enable-threads = true chdir = /usr/share/mailman3-web wsgi-file = wsgi.py master = true process = 2 threads = 2 uid = www-data gid = www-data plugins = python3 attach-daemon = python3 manage.py qcluster logto = /var/log/mailman3/web/mailman-web.log
I have no clue about where the “/mailman” is even coming from.
It is possible that uwsgi isn’t aware that it is serving the website at a subpath (“/mailman3”) instead of “/“, so the redirects don’t correctly take in to account the subpath. I see that the subpath is taken into account when there is a forward slash in the end and weird things happening when it isn’t.
Could be Apache not setting the “SCRIPT_NAME” var correctly always, but from the docs2 it seems to me that your configuration is correct. Maybe you can try setting the SCRIPT_NAME explicitly using uWSGIForceScriptName to “mailman3" and see if that helps?
Am 20.03.21 um 00:28 schrieb Abhilash Raj:
Can you also share your uwsgi configuration?
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
I solved this by using the <DirectorySlash> directive. See these for more info:
https://stackoverflow.com/questions/3133111/mod-rewrite-add-trailing-slash
https://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryslash
participants (4)
-
Abhilash Raj
-
glroman@pm.me
-
Jens Günther
-
Mark Sapiro