ejabberd - Comments for "Custom HTTP headers in mod_http_fileserver" https://www.ejabberd.im/node/2977 en Added js content type https://www.ejabberd.im/node/2977#comment-52343 <div class="quote-msg"> <div class="quote-author"><em>Ted</em> wrote:</div> <p>The content type of .js is application/x-javascript as far as I know. Just checked on firebug.</p></div> <p>Ok, added to SVN.</p> <div class="quote-msg"> <div class="quote-author"><em>Ted</em> wrote:</div> <p>About the first issue, sorry I'm reading the mailing list but didn't notice Alexey response.</p></div> <p>Sorry, I didn't explain correctly: I recently read the email with the question, so I asked Alexey, and I replied in the mailing list with his response. Then I told you in this forum :)</p> Mon, 05 May 2008 00:40:43 +0000 mfoss comment 52343 at https://www.ejabberd.im The content type of .js is https://www.ejabberd.im/node/2977#comment-52331 <p>The content type of .js is application/x-javascript as far as I know. Just checked on firebug.</p> <p>About the first issue, sorry I'm reading the mailing list but didn't notice Alexey response.</p> <p>The more I'm digging into ejabberd and it's file server the more I'm impressed with the possibilities.</p> <p>Thanks</p> Sun, 04 May 2008 19:56:21 +0000 Ted comment 52331 at https://www.ejabberd.im Content type of .js https://www.ejabberd.im/node/2977#comment-52330 <div class="quote-msg"> <div class="quote-author"><em>Ted</em> wrote:</div> <p>During my research I found that the function "element_to_string" and the next few functions defined in ejabberd_http.erl<br /> are also defined in xml.erl. Is there a reason for the code duplication?</p></div> <p>I remember the same question is in the ejabberd mailing list. Alexey Shchepin explained that crypt(S) is not exactly equal: there is a slight difference. The problem is that some browsers have problem with some encryption, so the code was duplicated from XML and adapted for HTTP requirements.</p> <div class="quote-msg"> <div class="quote-author"><em>Ted</em> wrote:</div> <p>In mod_http_fileserver.erl in the content_type(Filename) -&gt; function I didn't see a content type for javascript . Is it missing or is it ok?</p></div> <p>Well, I guess it is missing and could be added. What is the content type of ".js" ?</p> Sun, 04 May 2008 18:15:40 +0000 mfoss comment 52330 at https://www.ejabberd.im works great. I still think https://www.ejabberd.im/node/2977#comment-52329 <p>works great.</p> <p>I still think it will be useful to be able to set custom headers in the config file but my problem is solved for now.</p> <p>During my research I found that the function "element_to_string" and the next few functions defined in ejabberd_http.erl<br /> are also defined in xml.erl. Is there a reason for the code duplication?</p> <p>In mod_http_fileserver.erl in the content_type(Filename) -&gt; function I didn't see a content type for javascript . Is it missing or is it ok?</p> <p>Thanks.</p> Sun, 04 May 2008 17:26:41 +0000 Ted comment 52329 at https://www.ejabberd.im Yes, you can modify https://www.ejabberd.im/node/2977#comment-52326 <p>Yes, you can modify ejabberd_http_bind.erl and add any custom HTTP headers you want.</p> <p>I don't know if you are interested in this, but it could be implemented to return specific HTTP response headers depending in the HTTP request headers. For example, if UserAgent contains XX, then add this response header: "X-Custom: YY".</p> Sun, 04 May 2008 16:19:11 +0000 mfoss comment 52326 at https://www.ejabberd.im This is interesting because https://www.ejabberd.im/node/2977#comment-52268 <p>This is interesting because I'm trying to leverage the new FF3 and IE8 cross domain Ajax.</p> <p>With your code I have to set the same headers to all the requests.</p> <p>Can I implement it inside a costum module that use the fileserver api?</p> <p>For example, can I use it inside the http-bind module?</p> <p>Thanks</p> Sat, 26 Apr 2008 16:49:18 +0000 Ted comment 52268 at https://www.ejabberd.im Patch included. Feature tracked. Why is interesting? https://www.ejabberd.im/node/2977#comment-52209 <div class="quote-msg"> <div class="quote-author"><em>Anonymous</em> wrote:</div> <p>Where should I add it?</p></div> <p>Here is a simple patch:</p> <div class="codeblock"><code>Index: src/web/mod_http_fileserver.erl<br />===================================================================<br />--- src/web/mod_http_fileserver.erl&nbsp;&nbsp;&nbsp;&nbsp; (revisiĆ³n: 554)<br />+++ src/web/mod_http_fileserver.erl&nbsp;&nbsp;&nbsp;&nbsp; (copia de trabajo)<br />@@ -72,6 +72,8 @@<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {200,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [{&quot;Server&quot;, &quot;ejabberd&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&quot;Last-Modified&quot;, last_modified(FileName)},<br />+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&quot;X-Custom-1&quot;, &quot;test 1&quot;},<br />+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&quot;X-Custom-2&quot;, &quot;test 2&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&quot;Content-type&quot;, content_type(FileName)}],<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileContents};<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {error, Error} -&gt;</code></div> <div class="quote-msg"> <div class="quote-author"><em>Anonymous</em> wrote:</div> <p>Is there a chance it'll be supported in the future?</p></div> <p>I've reported the feature request:<br /> <noindex><a href="https://support.process-one.net/browse/EJAB-612" rel="nofollow" >Custom HTTP headers in mod_http_fileserver</a></noindex>.</p> <p>Why is this feature interesting? Why adding custom HTTP headers in the response?</p> Sun, 20 Apr 2008 17:44:35 +0000 mfoss comment 52209 at https://www.ejabberd.im I also need it. Where do I https://www.ejabberd.im/node/2977#comment-52190 <p>I also need it.</p> <p>Where do I add the above code?</p> Wed, 16 Apr 2008 08:31:02 +0000 Ted comment 52190 at https://www.ejabberd.im Where should I add it? Is https://www.ejabberd.im/node/2977#comment-52187 <p>Where should I add it?</p> <p>Is there a chance it'll be supported in the future?</p> Tue, 15 Apr 2008 16:18:30 +0000 Anonymous comment 52187 at https://www.ejabberd.im That feature is not https://www.ejabberd.im/node/2977#comment-52186 <p>That feature is not supported.</p> <p>But you can easily modify the source code:</p> <pre> [{"Server", "ejabberd"}, {"Last-Modified", last_modified(FileName)}, {"X-Custom-1", "test 1"}, {"X-Custom-2", "test 2"}, {"Content-type", content_type(FileName)}],</pre> Tue, 15 Apr 2008 14:53:38 +0000 mfoss comment 52186 at https://www.ejabberd.im