从GCS提供具有访问限制的静态页面 [英] Serving static page from GCS with access restrictions

查看:59
本文介绍了从GCS提供具有访问限制的静态页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google云存储上提供静态页面.只要它是公开的,它就可以很好地工作.现在,我设置了ACL,以便只有一组用户可以读取存储,未经身份验证的用户将被重定向到Google身份验证.现在的问题是,无法再找到该网站的静态内容,如javascript和css,我在那里看到404错误.静态内容也位于存储桶中,并且可以与公共URL一起正常工作.使用经过身份验证的网址时,它不再起作用.

I'm serving a static page on google cloud storage. It works perfectly well, as long as it is public. Now i setted up acl so that only users of one group can read the storage and unauthenticated users get redirected to google authentication. The Problem is now, that the static content of the website, like javascript and css can't be found anymore and i get 404 Errors there. The static content is as well in the storage bucket and it works fine with public urls. When using authenticated urls, it does not work anymore.

我尝试提供访问控制页面是否正确?我猜是这样,因为除了静态内容外,它还可以工作.那么,您对我在这里缺少什么有任何想法吗?

Is my attempt of serving an access controlled page right? I guess so, because it works, except for the static content. So do you have any ideas what i am missing here?

推荐答案

尝试在您归档的App Engine上进行部署.为此

Try to deploy on App Engine you file. For this

  1. 在您的静态文件的同一根目录中,创建一个具有此内容的 app.yaml 文件

runtime: nodejs10
env: standard
instance_class: F1
handlers:
  - url: /
    static_files: index.html
    require_matching_file: false
    upload: index.html
  - url: /(.*)
    static_files: /\1
    require_matching_file: false
    upload: /.*
  - url: .*
    script: auto

  1. 在App Engine上部署 gcloud app deploy
  2. 检查它是否可以在提供的网址上使用.

如果是这样:

  1. 转到安全"->身份识别代理(IAP)
  2. 为App Engine激活IAP;如果您之前没有这么做,则可能必须在此步骤中配置OAuth同意屏幕
  3. 选中根服务左侧的复选框,然后转到页面右侧的信息面板
  4. 添加具有 IAP安全的Web应用程序用户
  5. 角色的成员,组或域
  1. Go to Security -> Identity Aware Proxy (IAP)
  2. Activate IAP for App Engine; It's possible that the OAuth consent screen have to be configured at this step is you don't do it before
  3. Select the checkbox on the left of your root service, and go the the info panel on the right of the page
  4. Add members, groups or domain with the role IAP-secured Web app user

测试并享受!

这篇关于从GCS提供具有访问限制的静态页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆