Page MenuHomePhabricator

tools.wmflabs.org to Toolforge.org redirect query / post string propagation
Closed, ResolvedPublicBUG REPORT

Description

When using the new canonical redirect to *.toolforge.org, query / post strings are not propogated over the redirect.

E.g.

Visiting https://ipcheck-dev.toolforge.org/query.php?foo=bar yeilds:

$_GET:
Array
(
    [foo] => bar
)
$_POST:
Array
(
)

When visiting https://tools.wmflabs.org/ipcheck-dev/query.php?foo=bar you get:

$_GET:
Array
(
)
$_POST:
Array
(
)

I started my webservice using:

webservice --canonical --backend kubernetes php7.3 start

Event Timeline

SQL renamed this task from Toolforge.org query / post string propagation to Toolforge.org redirect query / post string propagation.Apr 19 2020, 7:46 PM
SQL renamed this task from Toolforge.org redirect query / post string propagation to tools.wmflabs.org to Toolforge.org redirect query / post string propagation.
bd808 triaged this task as High priority.
bd808 added a subscriber: bd808.

The fix for this is adding $is_args$args to the redirect annotation on the legacy ingress object. $is_args is an Nginx built-in variable which will be equal to "?" if there are query string arguments in the current URL and "" if there is no query string. $args (and it's synonym $query_string) is an Nginx built-in variable which will be equal to the full query string in the current URL or "" if there is no query string.

Here are the basics of how to hotfix a tool until we get the permanent fix packaged into webservice:

$ become $MY_TOOL
$ kubectl get ingress
NAME                    HOSTS                       ADDRESS   PORTS   AGE
$MY_TOOL-legacy         tools.wmflabs.org                     80      2d18h
$MY_TOOL-subdomain      ipcheck-dev.toolforge.org             80      2d18h
$ kubectl describe ingress $MY_TOOL-legacy | grep permanent-redirect:
  nginx.ingress.kubernetes.io/permanent-redirect:       https://$MY_TOOL.toolforge.org/$2
$ kubectl edit ingress $MY_TOOL-legacy  # The <tool name>-legacy ingress is always the one to edit
# Editor opens with YAML document describing the ingress object
# Find the "nginx.ingress.kubernetes.io/permanent-redirect: ..." line
# Add "$is_args$args" to the end
# Save and close the editor
ingress.extensions/$MY_TOOL-legacy edited
$ kubectl describe ingress $MY_TOOL-legacy | grep permanent-redirect:
  nginx.ingress.kubernetes.io/permanent-redirect:       https://$MY_TOOL.toolforge.org/$2$is_args$args

I tested the hotfix first on my bd808-test tool and then on @SQL's ipcheck-dev tool. webservice restart does not change the current ingress objects, so this will last until webservice stop is run. It can be manually reapplied after a webservice start.

Change 590671 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[operations/software/tools-webservice@master] legacy ingress: propagate query string to toolforge domain

https://gerrit.wikimedia.org/r/590671

Change 590671 merged by jenkins-bot:
[operations/software/tools-webservice@master] legacy ingress: propagate query string to toolforge domain

https://gerrit.wikimedia.org/r/590671

Mentioned in SAL (#wikimedia-cloud) [2020-04-20T12:46:14Z] <arturo> uploading tools-webservice v0.68 to aptly stretch-tools and update it on relevant servers (T250625)

Mentioned in SAL (#wikimedia-cloud) [2020-04-20T15:31:01Z] <bd808> Rebuilding Docker containers to pick up tools-webservice v0.68 (T250625)

bd808 added a subscriber: aborrero.