Firebase托管-如何阻止对某些文件的访问 [英] Firebase Hosting - How to prevent access for some files
问题描述
我在firebase托管的公用文件夹中有几个html文件,如下所示.
index.html
content_1.html
content_2.html
app.js
app.css
I have couple of html files in public folder at firebase hosting listed as below.
index.html
content_1.html
content_2.html
app.js
app.css
考虑域名为example.com
consider domain name is example.com
到目前为止,用户可以使用example.com/content_1.html或example.com/app.css语法访问所有这些文件.
as of now user can access all these file using syntax example.com/content_1.html or example.com/app.css.
是否可以阻止直接访问这些文件,但可以阻止index.html?我在通过jquery
is it possible to prevent direct access to these files but index.html ? I use these files while building the index.html through jquery
在Apache中,应该在httpd.conf上使用Order allow,deny
和Allow from all
,但不确定如何在Firebase Hosting上实现此目标.
In Apache would have used Order allow,deny
and Allow from all
at httpd.conf, but not sure how to achieve this on Firebase Hosting.
预先感谢您的帮助
推荐答案
是否可以阻止直接访问这些文件,但可以阻止index.html?我在通过jquery构建index.html时使用了这些文件
is it possible to prevent direct access to these files but index.html ? I use these files while building the index.html through jquery
除非您先在服务器上组装东西,否则您不能同时提供对网页所需资源的间接访问,也不能在客户端级别上阻止该资源在客户端级别上的直接访问,而与使用的Web服务器无关.
You cannot simultaneously provide indirect access to a resource required by a web page and block it from direct access at the client level regardless of the web server being used unless you're assembling things on the server first.
这篇关于Firebase托管-如何阻止对某些文件的访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!