Code Monkey home page Code Monkey logo

Comments (10)

steren avatar steren commented on August 23, 2024

Thanks.

Can you share which URL you are visiting the tool from? Is it https://cloud.withgoogle.com/region-picker/ ?

The tool isn't supposed to load https://cloud.withgoogle.com/data/countries.json but https://cloud.withgoogle.com/region-picker/data/countries.json

from region-picker.

hradhakrishnan avatar hradhakrishnan commented on August 23, 2024

Hi, i believe this is the url https://cloud.withgoogle.com/region-picker i used. Appears the only difference is that it's missing the forward slash at the end.

from region-picker.

steren avatar steren commented on August 23, 2024

Thanks. the URL is https://cloud.withgoogle.com/region-picker/

I can see if it's possible to also support the one you shared.

Out of curiosity, where did you click on the URL without the trailing / ?

from region-picker.

hradhakrishnan avatar hradhakrishnan commented on August 23, 2024

Hi, I'm not sure where I picked the URL from. Possibly typed it in. Hope this helps :)

Hari

from region-picker.

steren avatar steren commented on August 23, 2024

Thanks, I'll see if I can change the App Engine config to be compatible when the URL is missing the trailing /

from region-picker.

Deleplace avatar Deleplace commented on August 23, 2024

Some considerations:

The App Engine config LGTM, I'm not aware of any special power beyond "at the root of the current app, serve index.html".

However, the app in production lives under https://cloud.withgoogle.com/ which serves the sub-paths region-picker and region-picker/ alike by letting the appropriate App Engine app serve them. This creates confusion about the proper root path of the relative static assets.

Here are a few possible mitigations I can think of:

  1. Wherever the "wrong" URL exists in hyperlinks in the wild, change them with the "proper" URL with trailing slash ;
  2. Kindly ask the admins of cloud.withgoogle.com if they can return a 404 for the "wrong" URL. Not friendly, but much better that the current mostly-broken page ;
  3. Kindly ask the admins of cloud.withgoogle.com if they can return a 302 for the "wrong" URL, that seamlessly redirects to the proper URL ;
  4. Modify all of the relative paths in the app code to include as prefix the virtual folder "/region-picker/" e.g. background-image: url(images/icons/gleaf_black_24dp.svg); becomes background-image: url(/region-picker/images/icons/gleaf_black_24dp.svg);. The app.yaml is already set up to accommodate this trick. This can only be achieved by making sure that all the internal relative static resource paths do start with the prefix ;
  5. Add a JS workaround hack that "checks if window.location is missing the trailing slash, if so make a redirect" ;
  6. Change all of the relative paths into full absolute paths with production domain name (not great as the app is not self-contained anymore, and local dev becomes awkward).

It seems to me that (3), (4), (5) are actionable and would each be able to fix the problem.

@steren would you like me to try and make a PR for (4) or (5)?

Note that the whole thing is a bit error-prone, and we'll need to test carefully after a redeploy.

from region-picker.

steren avatar steren commented on August 23, 2024

Thanks for the suggestions.

  1. yes, it'd be good to check for where this URL is incorrect in the wild and send PRs

I think 3. would be best. but not sure what's feasible.

I would prefer the app not to assume it is served under /region-picker/ in case users want to deploy it somewhere else. So I am against 4.

I suggest to do 5. Feel free to send a PR.

from region-picker.

Deleplace avatar Deleplace commented on August 23, 2024

Implemented 5. in PR #8

from region-picker.

steren avatar steren commented on August 23, 2024

Thanks. Merged. It should auto-deploy. let's close once we confirm the issue is fixed

from region-picker.

Deleplace avatar Deleplace commented on August 23, 2024

This is indeed deployed in prod, and LGTM

from region-picker.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.