зеркало из https://github.com/golang/pkgsite.git
7796a18097
With the option to redirect automatically from godoc.org, there needs to be a mechanism to return to godoc.org and turn it off if necessary. Reliably knowing that a request is coming from a godoc.org redirect is complicated as you can’t set cross-origin cookies and 3XX redirects don’t alter the Referer header. In order to reliably know that a request is coming to pkg.go.dev from godoc.org, we look for a utm_source GET parameter set to 'godoc'. If we see this, we set a temporary cookie and redirect to the pkg.go.dev URL with the utm_source param stripped (so that it doesn’t remain in all our URLs coming from godoc.org). If this temporary cookie is seen, it is marked to be deleted and the correct value for the “Back to godoc.org” link is set. The existence of this value will be used to determine whether to show the button in the UI. Updates b/147492306 Change-Id: I9c2e6b891ba4f23b7490c087d32583cd7f0f6ad8 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/696565 Reviewed-by: Julie Qiu <julieqiu@google.com> |
||
---|---|---|
.. | ||
frontend | ||
prober | ||
worker |