consider my file
Test.mxml
output file
Test.swf
Each time i make some changes in Test.mxml corresoping swf file is generated.
But this is causing some problem in proxy server.
When i change the version of swf file generated its working fine(im able to see new changes as proxy server will load the new renamed file)(i tried versioning)
I cant see my changed swf file, its giving me cached swf file because of which the changes are not reflected.
A few approaches to handle this:
It may be possible to tell your proxy not to cache this file if you have any control over it.
Sometimes people use the "Random number" technique to prevent files from being cached. that is, in your HTML page that wraps your SWF; add a random number to the SWF location. Conceptually like this myswf.swf?someRandomNumber .
Every time you deploy a new build you could change the filename.
You can also try having your browser send the no-cache headers, which causes the (WebSphere Edge) proxy server to dump its cached copy too. In Firefox, at least, Shift-Reload does this. I think that's true in IE and maybe Chrome too.
Related
I'm using FastAPI and the Uvicorn server to build a website, but when I make changes to the CSS files and reload the webpage it doesn't pick up these changes.
In fact, even when I switch off the server and reload it, Uvicorn still doesn't pick up the changes to the CSS file.
Previously, the server picked up the changes fine, what's caused this to change?
The issue is not with Uvicorn, but with your web browser stashing 'static' files in its cache.
FastAPI uses a method that designates a directory the 'static folder'. This tells the server that the files in this directory should remain constant and don't need to be downloaded every time a webpage is loaded.
Check inside your app's main module and look for the following piece of code:
app.mount(
"/your_static_file_web_path",
StaticFiles(directory="your_static_directory"),
name="your_name_for_static_app"
)
This function creates a second FastAPI app within your pre-existing one that handles all of your static files. The second argument defines your static file directory. Anything within that directory will eventually be cached by your web browser and further changes will not be loaded. This prevents your page from loading the updated CSS.
As noted in a comment above, if you want to work around this issue, you can hold shift and reload the web page - this is known as a hard refresh. A hard refresh will force your browser to re-download everything, including static files.
We are running into issue where our clients are served stale js, css files after code is deployed. We are using IIS as our webserver and our code is in ASP.Net 4.5. I did some research and figured out that ETag in conjunction with Cache-control should work. As I understand ETag is automatically generated by web server based on datetime stamp of file so I ran following steps to see why the system is not sending the latest version of js and css files.
Navigated to my website to a webpage let's call is demo.aspx.(Now assuming that demo.aspx contains reference to a.js, b.js and c.css)
Verified that a.js, b.js and c.css file were requested by browser and webserver delivered those files after I hard refersh a page(Ctrl + F5) on my website.
Clicked on some other webpage
Went to webserve and manually updated files (a.js, b.js and c.css to update datetime stamp of those files)
Navigated to demo.aspx again.
This time I see only request made to demo.aspx but not to any of the resource file (a.js, b.js and c.css).
I am at loss as to why .js files are not requested when I access my demo.aspx page.
Also, Is there any easy way to force client browsers to download latest version of .js and .css files every time I deploy code. Based on my research, I did find out that one way to do would be to rename .js and .css file. Please note that this soution won't work for us.
We do use update panel in our projects. Not sure if that has anything to do with browser not requesting js files second time
A widely used trick is to add a query string parameter that is incremented with every new version of the css or js file.
Like myScript.js?version=12. When the the number changes the browser sees it as a new file and it's downloaded rather than retrieved from cache.
Just changing the timestamp by editing the file won't work, the browser does not get the timestamp from the server. You can try this by saving an image or file from the website, they all have the timestamp of when they were being downloaded.
Here's what I would like to accomplish:
I have a file stored in Windows Azure Blob Storage (or for that matter any file which is not on my web server but accessible via a URL).
I want to force download a file without actually downloading the file on my web server first i.e. browser should automatically fetch the file from this external URL and prompts the user to download it.
Possible Solutions Explored:
Here's what I have explored so far (and why they won't work):
Using something like FileContentResult as described here Returning a file to View/Download in ASP.NET MVC to download the file. This solution would require me to fetch the contents on my server and then stream from my server to the browser. For this reason this solution won't work.
Using HTML 5 download attribute: HTML 5 download attribute would have worked perfectly fine however the problem is that while it is really a very neat solution, it is not supported in all browsers.
Changing the file's content type: Another thing I could do (at least for the files that I own) to change the content type property of the file to something that the browser wouldn't understand and thus would be forced to download the file. This might work in some browsers however not in all as IE is smart enough to go beyond the content type and sees the file's content to determine the content type. Furthermore if I don't own the files, then I won't have access to changing the content type of the file.
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file.
Is this something which can be accomplished? If yes, then any ideas how I could accomplish this?
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file [without exposing the URL of the file to the client].
You can't. If the final URL is to remain hidden, your server must serve the data, so your server must download the file from the URL.
Your client can't download a file it can't get the URL to.
You can create file transfer WCF service (REST) which will stream your content from blob storage or from other sources through your file managers to client browser directly by URL.
https://{service}/FileTransfer/DownloadFile/{id, synonym, filename etc}
Blob path won't be exposed, web application will be free from file transfer issues.
Suppose the URL http://example.com/test.php. If I type this URL on the browser address bar, the PHP code is executed, and its output is returned to me. Fine. But, what if instead of executing it, I wanted to view it's source as plain text. Is there a a way to issue such request?
I believe that there must be some way, and my concern is that some outsider could retrieve sensitive code, such as configurations file, by guessing it's location. For example, Joomla instalations have a configuration.php on it's root folder. If someone retrieves such file as plain text, then these database credentials have been seriously compromised. Obviously, this could be prevented with proper permissions, but it's just too common to just issue 0777 as everything permissions and forgetting about access denials.
For PHP: if properly configured, there is no way to download it. File permissions won't help either way, as the webserver needs to be able to read the files, and that's the one serving contents. However. a webserver can for instance be configured to serve them with x-httpd-php-source, or the PHP/webserver configuration may be broken. Which is why files which don't need direct access (db config, class definitions, etc.) should be outside the document root, so there is no way those files will get served by accident even when the webserver config is incorrect / failing. If your current hoster does not allow you to store files outside the document root, switch hosting a.s.a.p.
There is a way to issue such request that downloads the source code of http://example.com/test.php if the server is configured to provide a URL to do so. Usually it isn't, so usually there is no way to issue such a request.
I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at ../../videos/video in relation to that swf.
Problem is, When I run it in Flex, everything is cool. Running locally, it can't find the file (not a security error) and is throwing a connectionError.
Any ideas?
NOTE: This seems to be a Windows specific problem, it's running on my mac with the same security settings just fine.
Flex Builder has a file that it adds all of your bin directories to in order to allow the debug player to get around the local security restrictions.
Here's a blog post on the subject.
Essentially Flexbuilder tells Flash that it should trust the bin folder... if you do a search on your development machine for the file flexbuilder_plugin.cfg, you should find it in a folder called FlashPlayerTrust in roughly the same area you normally find SharedObject files. If you open this file in a text editor, you should see pretty much every path to every bin folder for every flex project you have ever worked on. And suddenly everything gets so much clearer.
You can do as fenomas suggests and add any directory to your trusted list. You can also follow the advice from the above blog post.
So I created a new file and placed it next to this flexbuilder_plugin.cfg file, and called it MyProggy.cfg. Flash is configured to read in all files in this folder and parse all paths out of it, and any applications run from these paths will be considered "localTrusted" and will act as they would when run from Flexbuilder. Inside this text file I put one line: "c:\program files\my proggy" and saved it. I then had to restart Firefox for the change to take effect. I also had added a text label to my application and bound the text property to {Security.sandboxType}.
I would suggest getting HTTPFOX for Firefox which is a sniffer. Then you can see what is failing. In my own search I found that FLV's are always relative to the SWF, even when loaded on the WEB. Every asset that I have loaded is relative to the index.html file except for FLV's which always remain relative to the SWF. Being able to watch the data flowing, or attempting to flow to your site is invaluable.
This also explains why some people have no issue loading thing locally but then run into problems on the web. If their html file that is loading the swf is in a different location than the swf then every asset other than FLV's have a different relative path when viewed online then they do when viewed locally.