containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/mediawiki] 404 errors when overriding MEDIAWIKI_WIKI_PREFIX

Open dunn opened this issue 1 year ago • 6 comments

Name and Version

bitnami/mediawiki:1

What architecture are you using?

amd64

What steps will reproduce the bug?

set a non-default value for the prefix in the docker compose environment:

- MEDIAWIKI_WIKI_PREFIX=/something

then run docker compose up

What is the expected behavior?

MediaWiki is accessible at /something instead of /wiki

What do you see instead?

Every page under /something returns a 404 error:

mediawiki-1  | mediawiki 22:25:41.93 INFO  ==> Running MediaWiki install script
mediawiki-1  | mediawiki 22:25:43.06 INFO  ==> Configuring MediaWiki settings
mediawiki-1  | mediawiki 22:25:43.07 INFO  ==> Setting MediaWiki short URLs
mediawiki-1  | mediawiki 22:25:43.08 INFO  ==> Persisting MediaWiki installation
mediawiki-1  | mediawiki 22:25:44.95 INFO  ==> ** MediaWiki setup finished! **
mediawiki-1  |
mediawiki-1  | mediawiki 22:25:44.95 INFO  ==> ** Starting Apache **
mediawiki-1  | [Sat Mar 23 22:25:45.180354 2024] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.58 (Unix) OpenSSL/3.0.11 configured -- resuming normal operations
mediawiki-1  | [Sat Mar 23 22:25:45.180392 2024] [core:notice] [pid 1] AH00094: Command line: '/opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf -D FOREGROUND'
mediawiki-1  | 192.168.160.1 - - [23/Mar/2024:22:26:06 +0000] "GET / HTTP/1.1" 301 -
mediawiki-1  | 192.168.160.1 - - [23/Mar/2024:22:26:07 +0000] "GET /something/Main_Page HTTP/1.1" 404 196
mediawiki-1  | 192.168.160.1 - - [23/Mar/2024:22:26:07 +0000] "GET /favicon.ico HTTP/1.1" 404 196

Additional information

No response

dunn avatar Mar 23 '24 22:03 dunn

afaict the RewriteRule needs to match the prefix, instead of being hardcoded to /wiki: https://github.com/bitnami/containers/blob/main/bitnami/mediawiki/1/debian-12/rootfs/opt/bitnami/scripts/mediawiki/postunpack.sh#L50

But since postunpack.sh is run during the image build, it can't be overridden with environment variables.

dunn avatar Mar 24 '24 00:03 dunn

Thank you for opening this issue and submitting the associated Pull Request. Our team will review and provide feedback. Once the PR is merged, the issue will automatically close.

Your contribution is greatly appreciated!

carrodher avatar Mar 24 '24 12:03 carrodher

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Apr 09 '24 01:04 github-actions[bot]

un-stale

dunn avatar Apr 09 '24 16:04 dunn

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar Apr 15 '24 02:04 github-actions[bot]

>:(

dunn avatar Apr 15 '24 15:04 dunn

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar May 04 '24 01:05 github-actions[bot]

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar May 09 '24 01:05 github-actions[bot]

Hi seems I face a very similar issue. I tried to run mediawiki 1.41.1 under kubernetes with env variables MEDIAWIKI_HOST, MEDIAWIKI_WIKI_PREFIX and I'm redirected without any domain when I reach the /

image

But If I enter a full URL like https://wiki-mydomain.com/index.php/Main_Page it's displayed. But if I click on any link, I will face a redirection without my domain name again

EDIT: For who face this issue seems @dunn is currently working on PR #64098. Thanks a lot ☜(゚ヮ゚☜)

Ducatel avatar May 13 '24 15:05 Ducatel

Hi,

Do you know when docker image will be available on hub with this fix ? Thanks

Ducatel avatar May 22 '24 09:05 Ducatel

Hi @Ducatel,

The latest version of the bitnami/mediawiki image now includes the fix (1.41.1-debian-12-r8).

migruiz4 avatar May 22 '24 13:05 migruiz4

Ok So still not working for me. let's open a dedicated one

Ducatel avatar May 22 '24 14:05 Ducatel

Hi

As I just mentioned in the PR, these changes are breaking the functionality of the container, you get several redirect loops when you try to access the app or work with it. This is preventing our test to pass and update the Chart solution.

We are planing some changes to make the solution work again and they will be included in the next release:

  • Recover the old logic to configure the $wgServer parameter in the conf file
  • The $wgCanonicalServer parameter uses that configuration by default according to the official documentation: https://www.mediawiki.org/wiki/Manual:$wgCanonicalServer
  • RewriteRules will be updated to use the ones mentioned in the official documentation https://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_Title_--_.htaccess

If you continue running into issues when running the app behind a proxy, please do create another PR to update the configuration taking these changes into account.

jotamartos avatar Jun 06 '24 10:06 jotamartos

Changes were applied here: https://github.com/bitnami/containers/pull/67621

jotamartos avatar Jun 06 '24 13:06 jotamartos

Thanks for letting me know, I'll take a look.

dunn avatar Jun 06 '24 14:06 dunn