Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/website: golang.org wrongly redirects to golang.google.cn sometimes #47808

Closed
ericlagergren opened this issue Aug 19, 2021 · 8 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ericlagergren
Copy link
Contributor

ericlagergren commented Aug 19, 2021

Upon visiting golang.org I'm redirected to golang.google.cn. This is wrong as my IP addresses are from the United States.

IPv6: 2001:19f0:8001:1ef6:5400:3ff:fe84:5ac
IPv4: 144.202.86.213

Also affects the playground.

@ericlagergren ericlagergren changed the title golang.org geolocation bug x/website: golang.org geolocation bug Aug 19, 2021
@gopherbot gopherbot added this to the Unreleased milestone Aug 19, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 19, 2021
@mknyszek
Copy link
Contributor

CC @dmitshur

@mknyszek mknyszek changed the title x/website: golang.org geolocation bug x/website: golang.org wrongly redirects to golang.google.cn sometimes Aug 20, 2021
@rsc rsc self-assigned this Aug 20, 2021
@xxchan
Copy link

xxchan commented Aug 20, 2021

Also for go.dev

@rsc
Copy link
Contributor

rsc commented Aug 20, 2021

As background, on the China-available Go home page we cannot serve user-generated content like playground shares.
Until recently the way we did this was by silently dropping content based on where the request came from.
So for example requests served for golang.org to China left out the Share button under the home page playground.
The same was true for golang.google.cn, which is the actual page that is visible in China.

This IP-specific content bothered me and complicated caching, so I changed the code for 'golang.org in China', which is supposed to not happen anymore (golang.org was visible in China for a few months back in ~2016, long story) to redirect to golang.google.cn, before any cache lookups. Then any caching done after the redirect in the serving path is fine.

This redirect has the effect of making it much clearer when we accidentally think a request is coming from China. Before, a few links would be missing and people wouldn't notice at all. Now, the redirect happens, which is more noticeable. Especially if the redirect changes a go.dev request to golang.org, which breaks the request entirely.

I put the old serving stack back up at https://oldstack-dot-golang-org.appspot.com/golang.org/.
@ericlagergren and @xxchan, I'd be interested to know whether you see a "Share" link under the home page playground.

I will also look into why the geolocation is not working correctly. I wish we didn't have to do any of this, of course, but it is well beyond my powers to change these rules.

@xxchan
Copy link

xxchan commented Aug 20, 2021

@rsc There's no "Share".

@ericlagergren
Copy link
Contributor Author

ericlagergren commented Aug 21, 2021

@rsc thanks for the explanation! I always appreciate how thoughtful you are.

I'd be interested to know whether you see a "Share" link under the home page playground.

I do not.

I will also look into why the geolocation is not working correctly.

Thank you. FWIW: the IP addresses in question are attached to my VPS which is located (five minutes from me!) in Seattle. If I'm not signed in, Google redirects me to google.com.hk. I think they've flagged whole blocks of addresses owned by Vultr as these aren't the first IP addresses it's happened with—just the first time I've decided to create an issue. :)

I wish we didn't have to do any of this, of course, but it is well beyond my powers to change these rules.

I understand—it's definitely unfortunate.

@rsc
Copy link
Contributor

rsc commented Aug 23, 2021

Thanks for checking the old site. Now that we have the separate domain, I've gotten approval to drop the IP-based check here entirely. That should be in effect within a day or so and will fix this problem for golang.org.

@gopherbot
Copy link

Change https://golang.org/cl/344289 mentions this issue: cmd/golangorg: disable IP-based China detection

@rsc
Copy link
Contributor

rsc commented Aug 23, 2021

As of right now the IP-based check should no longer be active. Thanks for the reports.

@rsc rsc removed their assignment Jun 23, 2022
passionSeven added a commit to passionSeven/website that referenced this issue Oct 18, 2022
The IP-based detection of requests from China is from back in 2015
when we were preparing to serve golang.org directly in China.
In 2018 we arranged to use golang.google.cn instead,
but the old IP-based detection has lingered.
It is no longer required, and it has false positives, so remove it.

Fixes golang/go#47808.

Change-Id: Ia7854456f8c0614c55007688e65c3c62c1799f33
Reviewed-on: https://go-review.googlesource.com/c/website/+/344289
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Website-Publish: Russ Cox <rsc@golang.org>
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants