Note that there are some explanatory texts on larger screens.

plurals
  1. PODirect serving files from outside of Play directories structure
    primarykey
    data
    text
    <p>ellou' Players </p> <p>I need to crate custom <code>CDN</code>-like solution for small app purposes and wonder what is the best way to serving files directly with Play, but not placed under the <code>public</code> directory of the application? I need to gain access to FTP-upload folder.</p> <p>Let's say that my app is run from <code>/home/myaccount/playapps/app201</code> folder and is available at <code>http://somedomain.tld</code> address. I have also a common FTP account with folder pointing to <code>/home/myaccount/ftp_upload</code>.</p> <p>What is the best way to serve file <code>/home/myaccount/ftp_upload/folder_1/sub_2/file.txt</code> as <code>http://somedomain.tld/ftp_upload/folder_1/sub_2/file.txt</code> (without any checks and restrictions)?</p> <ul> <li>One option is to use HTTP server and set separate <code>host</code> or <code>alias</code> for <code>ftp folder</code> , but I would like to avoid using additional servers on some nodes (<strong>ref:</strong> <em>if you're looking for server solution check the <a href="https://stackoverflow.com/questions/10882313/play-framework-2-0-how-to-display-multiple-image/10884297#10884297">sample config</a></em>).</li> <li>Second is writing <code>Application.serve(String filepath)</code> action + route, but I don't need any additional actions before serving files. Is that make sense to use this approach?</li> </ul> <p>Is there other option available?</p> <p>(this question is also available at <a href="https://groups.google.com/forum/?fromgroups#!topic/play-framework/OWFKlDE12mY" rel="nofollow noreferrer">Google Groups</a>)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. COMay I ask for some details? Part of the usefulness of a CDN -- at least in my opinion -- is that your requests don't contain cookies, because it's filling up unnecessary bandwidth. Is that part of the solution you wish for, e.g. serving dynamic requests from `www.example.com` and static requests (CDN) from `cdn.example.com` (or a whole different TLD)? Also, are most of your requests static (CDN) or dynamic? Maybe you have a rough percentage. It could also help to know if your main static dataset is small, say 90% of static requests are for at most a few GB of data.
      singulars
    2. CO@Carsten, thx for response. I want to place large media files and other `fully public` stuff apart of app's structure, because I don't need access control for it. The App in this case holds paths and metadata - and of corse renders front-end. My goal can be easily demonstrated with use a front-end http server and alias for some folder [described here]( http://stackoverflow.com/a/10884297/1066240) , but I want to avoid use of the HTTP server. On the other hand I think that I just also can deploy app at port 80 and some lightweight server to catch the static requests.(will be more...)
      singulars
    3. CO@Caresten: (...more :)) I just realised (thanks to you) that serving these data from other domain will prevent cookie sending, which can be also good point for performance boost.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload