Firebase hosting - prevent user from seeing my code - firebase

Firebase web hosting
I have uploaded to the public folder 3 items:
index.html
js folder
css folder
I notice that I can browse to the folders and actually see the js file or css under these folders. I want to prevent it.
I tried to put .htaccess but it does not seem to have any effect at all.
I need your assistance how should I prevent directory browsing?

Related

how to serve image from custom folder?

I have this site deployed in IIS:
Now what I am trying to do is to show an image under the App_Data folder, the path being "App_Data/uploads/abc.jpg"
In code I have this:
<img src="~/App_Data/uploads/abc.jpg" alt="img">
and then I get a 404 error suggesting resource not found. When I inspected the sources tab in chrome dev tools I have this :
This means the App_Data folder was not even served in the request in the first place now how could I serve the folder, the folder contains images of my products. Also if someone could suggest if this is a good approach since there would be thousands of product images and I don't necessarily need to serve the entire folder for each request there has to be a better way, Thanks
In the iis request filtering, the app_data folder cannot be accessed, so I suggest creating a new folder and uploading image to this folder.

How to manually add a .txt file at page root in Gatsby JS?

I want to retrieve access to a Google Analytics account. Google has advised me to create an analytics.txt file at the root of the website such that htttp://my-site.com/analytics.txt.
How do you manually place a .txt file at the root of a site using Gatsby? Gatsby compiles JS files into HTML. I've tried manually placing an analytics.txt file in the /public folder but that doesn't seem to have worked either.
The Gatsby documentation is not helpful on this topic.
We are deploying the site using Netlify and storing the source code on Git Lab.
Any help would be appreciated.
If you create in your root project a folder named static, it will compile with the same name and internal structure in the public folder, so you will be able to refer to those files and assets in your React components. You can check for further information in their docs.
However, in your case, you may want to use a Gatsby plugin to place your analytics code. Here's the documentation.
In the scenario you've described, your solution didn't work because the public folder is regenerated in each build/compilation of code so your .txt is deleted in each compilation.

Which directory/folder should I upload my index.html (homae page) in?

this picture features the cpanel of the website I own. Check the image carefully and you will find out that there's "nothing" to be shown in "public_html" folder. But when ever I visit my domain (www.tumajnuri.com) I see the advertising banner of the service I bought the domain from. As an amateur, this is the first time I decide to upload web pages. I already learned this fact that "public_html" is the default "root" folder of many domains, but nothing exists within this folder. I should find out which folder contains this "jpg" file so, I can delete and replace it with my index.html. Thanks!
My cpanel: http://www.tiikoni.com/tis/view/?id=8826319
The default that you can upload/change is the public_html/index.html.
If you do not upload anything there is an other default that you can not change.
It is the domain/hosting service's html.

Meteor: how to serve images outside the /public folder?

Using Meteor I'm writing a framework that can serve custom themes in the /themes folder. I'd like the images of each theme to stay inside the corresponding theme folder.
From the Meteor documentation:
Lastly, the Meteor server will serve any files under the public
directory, just like in a Rails or Django project. This is the place
for images, favicon.ico, robots.txt, and anything else.
How can I serve images to clients from outside the /public folder?
Well, you have to think of /public as the root folder when Meteor is serving its content.
So if you have content in /public/themes/x.jpg when you are referring your image in HTML you would do something like /themes/x.jpg
If I'm not understanding your question correctly, please tell me so. I will try my best to answer.

Meteor public folder not working

I'm new to Meteor and I'm trying to understand how to serve static content - images, JS, etc.. I've followed the docs by creating the correct folder structure (which it doesn't really touch on) but making requests to this content just fails over to serving the main app page instead.
For instance - putting an image in "app_root"/public/image.png and making a request to localhost:3000/image.png just returns the main app page.
Any clue what I'm doing wrong here?
Thanks!
The setup you have described sounds correct to me. Media in public/ are served like
http://localhost:3000/myphoto.jpg
The todos example serves images from the public directory. Just back out of whatever project you're in and run: meteor create --example todos then cd into todos/ and run meteor. Then open:
http://localhost:3000/destroy.png
The image you will see lives in public/.
Meteor public folder not working
Use ./public directory for serving static assets.
Given the following directory structure:
- server
- client
- public
- css
- bootstrap.css
- images
- js
You could serve the static assets by dropping 'public' from linked documents.
<link href='/css/bootstrap.css'>
More info here: Official Meteor Docs #FileStructure
Files in /public are served to the client as-is. Use this to store
assets such as images. For example, if you have an image located at
/public/background.png, you can include it in your HTML with or in your CSS with background-image:
url(/background.png). Note that /public is not part of the image URL.
That same thing happened when I moved the project files in a folder and forget to move the directory .meteor.

Resources