From c807880f7ac73f813b2660ea81a00f7712a4e793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 29 Aug 2016 12:39:49 +0200 Subject: Add old mailing list archives --- archives/extend/2013-July/000153.html | 113 ++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 archives/extend/2013-July/000153.html (limited to 'archives/extend/2013-July/000153.html') diff --git a/archives/extend/2013-July/000153.html b/archives/extend/2013-July/000153.html new file mode 100644 index 00000000..6041d7cd --- /dev/null +++ b/archives/extend/2013-July/000153.html @@ -0,0 +1,113 @@ + + + + [99s-extend] Serve static files with cowboy from some applications + + + + + + + + + + +

[99s-extend] Serve static files with cowboy from some applications

+ Alexander Kuleshov + akuleshov at tpip.net +
+ Wed Jul 17 16:47:43 CEST 2013 +

+
+ +
Hello,
+
+I have a web application which used cowboy (from master). I need to serve some static files, it's usual web application but i can use usual dispatch something like this:
+
+    Dispatch = cowboy_router:compile([
+        {'_', [
+                {<<"/static/v/[...]">>, cowboy_static, [
+                    {etag, {attributes, [filepath, filesize, inode, mtime]}},
+                    {mimetypes, [
+                            {<<".js">> , [<<"application/javascript">>]},
+                            {<<".css">>, [<<"text/css">>]},
+                            {<<".gif">>, [<<"image/gif">>]},
+                            {<<".png">>, [<<"image/png">>]},
+                            {<<".jpg">>, [<<"image/jpeg">>]},
+                            {<<".html">>, [<<"text/html">>]}
+                    ]},
+                    {directory, {priv_dir, my_app, [<<"static">>]}}
+                ]}
+        ]}
+    ])
+
+And i try to explain why. In fact, i have one application (this application) which used cowboy and many plugins for it. Every plugin is an erlang application and also every application has own static files. I need routing something like this:
+
+if path /static/v/my_app/index.html than serve index.html from my_app
+
+if path /static/v/other_app/test.js that serve test.js from other_app.
+
+and etc....
+
+Main goal to change: `my_app` from here: {directory, {priv_dir, my_app, [<<"static">>]} dynamically or write custom static handler.
+
+How to do it correctly with cowboy?
+
+Thank you.
+
+-- 
+Alex Kuleshov
+Software Developer
+
+email: ak at travelping.com
+phone: +77172227194
+mobile: +77019442517
+
+----------------- enabling your networks ---------------------
+Travelping GmbH               phone: +49-391-8190990
+Roentgenstr. 13               fax: +49-391-819099299
+D-39108 Magdeburg             email: info at travelping.com
+GERMANY                       web: http://www.travelping.com
+
+Company Registration: Amtsgericht Stendal Reg No.: HRB 10578
+Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780
+--------------------------------------------------------------
+
+
+ + +
+

+ +
+More information about the Extend +mailing list
+ -- cgit v1.2.3