How do you protect images from hotlinking if they are hosted with firebase? - firebase-hosting

I want to protect images from being hotlinked on my firebase hosted site. Keep in mind these images are not located in the storage area of firebase where I know rules can be deployed. Is there a way to disable hotlinking in the header config or elsewhere?
I have consulted the hosting docs, but I am not sure what I am trying to achieve is possible.

Related

can I use CDN with images?

can I use CDN with images ? and if can then how to use it with upload from website to CDN server
Yes, and you can check with your CDN provider on the methods they allow for uploading,
such as
pull (CDN server download the files from your website/server)
or
push (sent from your website/server to the CDN server)
Example : automatic push to CDN deployment strategy
Seems like there are a few options to accomplish this.
The first one would be using the CDN as Origin. In which case, there is already an answer with some advice.
The second option would be using your current website as Origin for the images. In which case you will need to do some DNS work that would look something like this:
Published URL -> CDN -> Public Origin
Step 1 - images.yoursite.com IN CNAME images.yoursite.com.edgesuite.net --- This entry will send all traffic requests for the images subdomain to Akamai's CDN edge network.
Step 2 - origin-images.yoursite.com IN A or IN CNAME Public front end for the images
So the way it works is that in step one you get a request for one of your images, which will be then sent via DNS to the edge network in the CDN (in this case Akamai HTTP only). If the CDN does not already have the image in cache or if its cache TTL is expired, it will then forward the request to the public origin you have setup to pull the file, apply any custom behavior rules (rewrites, cache controls override, etc), cache the content if marked as cacheable and then serve the file to the client.
There is a lot of customization that can be done when serving static content via CDN. The example above is very superficial and it is that way to easily illustrate the logic at a very high level.
Do you mean you want to use a CDN to host images? And you want to upload images from your website to the CDN or use the website run by the company hosting the CDN to upload the images?
Ok, firstly yes you can use a CDN with images. In fact it's advised to do so.
Amazon CloudFront and RackspaceCloud's Cloudfiles are the two that immediately spring to mind. Cloudfiles you can upload either by their API or through their website and CloudFront you upload to Amazon's S3 storage which then hooks into the CloudFront CDN.
In common CDN setups you actually don't upload images to the CDN. Instead, you access your images via a CDN, quite like accessing resources via an online Proxy. The CDN, in turn, will cache your images according to your HTTP cache headers and make sure that subsequent calls for the same image will be returned from the closest CDN edge.
Some recommended CDNs - AWS CloudFront, Edgecast, MaxCDN, Akamai.
Specifically for images, you might want to take a look at Cloudinary, http://cloudinary.com (the company I work at). We do all of this for you - you upload images to Cloudinary, request Cloudinary for on-the-fly image transformations, and get the results delivered via Akamai's high-end CDN.

Is wordpress supposed to automatically load images over https?

When I try to access my website over https, I get a mixed content error. Looking at the console, The offending resources are all images that are uploaded using the wordpress media uploader.
But isn't wordpress smart enough to know that it should serve those images over ssl if the https version of the website is requested? If not, is there an easy solution to resolve this issue (besides from editing every post to replace say http://example.com/image.jpg with //example.com/image.jpg)
Wordpress has a plugin that does this trick. Wordpress HTTPS(SSL)
It replaced all images loaded through "HTTP" with "HTTPS".

Only one ftp user is enough for an uploading proccess at image hosting site?

I have a image hosting website and I'm thinking of using a new server to host the images, the main server "misitio.com" plus a new server that will contain the images "img1.misitio.com".
The images will be upload to the my main server and then it will be transferred to the new server by ftp (all in php code), my question is whether i will have problems using only one user to upload pictures, ie, if many visitors are uploading pictures in simultaneous there will be problems with the connection to the ftp server? (as it always will be using only one user).
We came up with a solution for this in the past. We used a CDN for hosting and serving the images via Rackspace. We accepted the images to be uploaded as normal and then ran a script that synced (push only files that don't exist on the remote site) files to the CDN. That process runs automatically every hour. After 3 hours, we would delete the image from the source webserver. So the CDN was the primary store of all the images and it didn't impact the work the web server had to do to server those images to visitors (let the CDN do the work). Then on a weekly basis, we can a script that would crawl the 400K+ image files in the CDN and cross reference our DB to verify the images weren't orphaned. If they were, they were deleted. Of course, you always had a little bloat in the CDN of images that were orphaned, but they would get removed eventually and the cost to store and server on the CDN was cheap. Be sure to update your website code to reference all images with your CDN address. We set up a CNAME in DNS to mask that public CDN url from users.

Connecting ColdFusion to CDN [closed]

I'm just wondering whether anyone out there has managed to connect up a ColdFusion based CMS to a CDN for content hosted within it ?
We currently have our own CMS and we make use of CKEditor and CKFinder to display content. However, we are noticing that it might benefit from taking advantage of a CDN for static content.
What I'm wondering is how does one go about connecting a CMS to a CDN? All I've been able to find is articles on using existing wordpress modules for connecting content for websites.
Any info would be greatly appreciated.
You don't need to connect a CMS to a CDN that is not how CDNs work.
Let's say your assets are served on assets.mydomain.com to utilise a CDN you create an account with one and register a CName pointing at the CDNs servers let's say that is static.mydomain.com. On the CDN you configure assets.mydomain.com to be the origin for static.mydomain.com.
Now you reference all your assets in the HTML of your website using static.mydomain.com. This is where the CDN does its clever bit. When an asset is requested the CDN checks to see if it has it, if not it requests it from the origin and simultaneously caches it so the next time you are asked for that asset it returns it from the CDN cache.
So really to connect your CMS to the CDN as you ask is achieved by making sure that the assets are requested off of a domain you have configured as above.

Why load images from different domain?

I have learned that browsers can only load a few files from the same domain at the same time. Therefor you should place your images on a different domain, or on a subdomain, to speed up page performance. Something like that...
Is it worth building websites like this or will browsers change this function soon? Or maybe they allredy have?
Or maybe better asked: When will it be unneccessary to load your images from other domains for page performance?
The websites I am buling will not have there images hosted on a CDN...
The browser limits the concurrent HTTP connections to a single server for the server's sake. While the limits have been increased in most browsers over time, there will always be limitations in web development and if you're a serious web developer you should suck it up and adopt the current best practices for working within them.
Without hosting your images on a CDN you can reduce the number of requests by combining your images into CSS sprites when appropriate. Check out the logo on StackOverflow, for example :)
Also, combine your CSS and Javascript into single files for production deployments.
You can use a subdomain like static.example.com to serve static files like images and videos. The advantage of such a usage will be on server side where you serve static.example.com from a fast server like nginx while keeping the example.com proxied to apache. As a result of this client will be able to download these static resources faster since they are served faster.

Resources