I am fetching the image urls from database (dump from production server).
For example, say - https://example.com/imageStorage/photo.jpg is an url fetched from database.
And these urls are used to show images in HTML templates like this -
<img [src]="url">
Now in development i want to redirect these urls to fetch images from a local folder. I am using NodeJS express and angular in my application. Is there any way to do it. I tried to proxy the requests with no success.
Use this extension
https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj?hl=en
and then add a url redirect like this
I have a NFS location that is not managed by me and it's contents can be accessed by browsing to it, i.d. the server is serving up the folder as a HTML page.
something like https://ftp.mozilla.org/pub/firefox/releases/52.0/
Is it possible to get the list of files in a JSON format response directly in the request response? Without changing anything on the NFS server and without having to write code to parse the HTML?
e.g., Maybe I can send the request to the URL with different headers.
To clarify:
When you access the address with a browser, curl or wget, you get a HTML page.
My motivation is that I don't want to mount the NFS location. I want to access the files by downloading them from the URL.
I don't know the type of server that is holding the shared folder.
Thanks.
In short, the answer is NO.
Not without tweaking the settings on the webserver that is serving the folder contents.
Here are some examples of how to tweak Apache to serve JSON formatted files listing for the folder.
Apache directory listing as JSON using PHP
Apache directory listing as json
Apache External Module mod_jsonindex - May not be the recommended way
http://1h.com/opensource/mod_jsonindex.html
I have a json file with information scrapped dayly from the web and as it's just a small array I decided to put it in a file in the public folder and read it client side. The array will be used as the options for a select tag.
I would like to read it only client side without pinging the server. How can I read the file in a template helper?
As I'm new to web development the file client side solution was the one I thought was best. If you believe there's a better way please state it and explain why is better. Thanks
You can use the http package to make a httprequest to the 'public' folder.
HTTP.get("yourweb/yourfile.json",{},function(error,result){
//do something with result
});
https://docs.meteor.com/api/http.html
I'm working on a web-based Flash application for a client which loads an external file from the same directory it is located in on the server. I use a URLRequest to load the file:
loader.load(new URLRequest("Config.xml));
Right now the Config.xml file uses chmod 644, which gives it public read access. However, the client would like to protect the configuration file so that it can't be downloaded by third-parties.
I'm thinking that it won't be possible to hide the file by removing public read permission (chmod 640) because then the Flash document, which is executed client-side, will be unable to read it. My tests seem to confirm this. Is there any way for a Flash app on the web to read a file from the server without exposing it to the public?
As others have already said, you can't do this. For the SWF to be able to load the file from the client-side it must be public.
A possible solution that might be good enough for your client is to embed the XML file contents in your HTML on the server side, for example as FlashVars or JavaScript output, then the SWF does not need to load the XML file directly and you don't need to make the file public.
For example:
Server-side PHP:
<?php
$xml = file_get_contents("Config.XML");
$encodedXml = rawurlencode($xml);
?>
<object type="application/x-shockwave-flash" data="my-flash.swf" width="550" height="400">
<param name="movie" value="my-flash.swf" />
<param name="FlashVars" value="config=<? echo $encodedXml ?>"/>
</object>
Client-side AS3:
var xml:XML = XML(stage.loaderInfo.parameters.config);
Of course someone could look at your HTML source and decode the XML themself, but any way you get the XML content into your SWF will expose that possibility, to varying levels of difficulty. You could make the encoding more obfuscated (url encoding is easy to spot) or encrypted to make it harder to find.
No. Flash is using a regular HTTP request to load the config file, so of course it can't get the file if it's not publicly-accessible.
What you could do is require authentication for the config file and include credentials in your URLRequest declaration. However, this still suffers from the weakness of someone sniffing the traffic to discover the authentication, and then running that request again with another tool.
Ultimately, you can't have it both ways: Either your config is accessible and insecure, or it's secure but unusable.
The short answer :
No, you can not do that.
The long answer :
No, you can not do that because, as you already know, Flash Player is a client-side technology, so it's exactly the same as a browser, and any file loaded by your SWF is accessible and visible for absolutely any person who has access to that SWF file, also forget about files access permissions which didn't has any effect in this situation.
Note here that you can use some encryption system to encrypt the content of that file and your SWF will decrypt it, but the problem here, is that you have also to encrypt your SWF file which, to my knowledge, is not a very reliable technique because SWF decompilers are really very efficient nowadays ...
...
Hope that can help.
A client side app (Flash or other) cannot read or load by itself any files from a server even from the server it's coming from. When it loads a public xml file, it makes a request for it and if the file has the right permission and the server knows how to serve that file, the request is granted and the file is served. This is very much so a server side operation so you can know see that when you say: "Flash runs client-side, so how would I take any advantage of a server-side solution?" this is a clear misunderstanding of how things work on client side and server side because if you do load a xml file then you do take advantage of a server side solution. Now this being said, how to do it when the file permission if turned of.
It is common to not allow access to files or directories on a server, in that case a client side cannot be granted access to those directly. So this is when you need to use a serve side technology to serve those files. Serve side technology like for example PHP can access all files on the server and make copy of them or change temporarily their permission etc ...
You can serve to your client side those forbidden files by simply writing a serve side script that would serve the file to you depending on some criteria you define (or none). The server side can change the permission allowing you to download it and then change it back, or it can copy the file and put it in a public accessible place and then delete it. You can also change the extension of your xml (to .whatever for example) and not provide a mimetype for it, even though the file is public the server won't be able to serve it, you can then make you serve side script change its extension for you on a per need basis. There's just hundreds of ways to do it including web services and even AMF and all that while the needed file is not publicly accessible. But yes you have to write server side scripts which is a VERY COMMON way to serve files to client side.
I have a basic webpage built, and a Swagger document JSON file of my API. I am unsure of how to actually add the data from the document to the website so that it can be browsed.
I want to build hosted documentation for the API.
This is the example given by Swagger: http://petstore.swagger.wordnik.com/#!/pet/addPet
Do I just download Swagger UI and use it in conjunction with the JSON file.
But I am unsure on to achieve this. Any advice on how to go about creating something like this would be very helpful.
Swagger-ui is basically a set of static files you can host on your server to display your API.
Unless you may any major changes, you just need to copy the contents of the /dist folder to your server and host it as part of your application (or static website, doesn't matter).
The SwaggerUi object can be customized to your needs, including the URL of the spec you're hosting.
Keep in mind that if you don't host the ui and spec on the same server, (that is, same host and same port), you need to enable CORS.