containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/mediawiki] improve configuration for reverse proxy configs

Open dunn opened this issue 1 year ago • 3 comments

several changes to improve behavior when running behind a reverse proxy:

  • we need the RewriteRule in the vhost to match $wgArticlePath in the application LocalSettings.php, which requires that it be modified at startup in order to respect custom values of MEDIAWIKI_WIKI_PREFIX.
  • setting $wgScriptPath to "" is fine for the normal case, but if you're running behind a reverse proxy and want to serve MediaWiki on one path (e.g., /wiki) and other services on other paths, being able to set the script path as non-root makes proxy routing easier.
  • setting $wgServer to MEDIAWIKI_HOST results in absolute URLs including the full hostname and port, instead of relative URLs, which breaks links when the reverse proxy is running on a different port. for the same reason, set $wgAssumeProxiesUseDefaultProtocolPorts to false.

Fixes https://github.com/bitnami/containers/issues/64097

dunn avatar Mar 24 '24 00:03 dunn

added a few commits, i was going to make separate PRs but these changes depend on each other. i'll update the PR description.

dunn avatar Apr 02 '24 20:04 dunn

anything i can do to help move this forward?

dunn avatar Apr 15 '24 19:04 dunn

@migruiz4 thanks for the review! I added a commit setting MEDIAWIKI_SCRIPT_PATH to / by default, restoring the existing behavior.

dunn avatar May 12 '24 19:05 dunn

Hi @dunn,

Thank you for your contribution. However, 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 09:06 jotamartos

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

jotamartos avatar Jun 06 '24 13:06 jotamartos