/static doesn't work in https mode
comptekki opened this issue · comments
I just tried using /static using https mode and it didn't like it.
details please?
With code below. Running start_http works with /static/jquery.js but
start_https, when it does a request for jquery in /static it can't
find it.
%%
start_http(Port) ->
misultin:start_link([
{port, Port},
{static, ?STATIC},
{loop, fun(Req) -> handle_http(Req, Port) end},
{ws_loop, fun(Ws) -> handle_websocket(Ws) end}
]).
%%
start_https(Port) ->
{ok, [{CertPasswd},,,,]}=file:consult(?CONF),
misultin:start_link(
[
{port, Port},
{loop, fun(Req) -> handle_http(Req, Port) end},
{ws_loop, fun(Ws) -> handle_websocket(Ws) end},
{ssl,
[
{certfile, ?CERTFILE},
{keyfile, ?KEYFILE},
{password, CertPasswd}
]}
]).
I then added for https:
handle('GET', ["jquery-1.6.4.min.js"], Req, _Port) ->
Req:file("/path/jquery-1.6.4.min.js");
and it worked (I also removed /static from html code).
If you need the error, I can send that.
-wes
On Fri, Jan 20, 2012 at 2:01 PM, Roberto Ostinelli
reply@reply.github.com
wrote:
details please?
Reply to this email directly or view it on GitHub:
#93 (comment)
can't reproduce this at all, works fine here.
. are you actually hitting https from your browser?
. can you run SSL without the static option?
if so, please send me the error.
I am using https when I get the error. When using http, /static works fine.
example:
<script type='text/javascript' src='/static/jquery-1.6.4.min.js'></script>works fine with http.
with https I have to have jquery at / and then put in get handler and
then it works. If I try to use /static/jquery..... (and remove get
handlers) I get this error:
=ERROR REPORT==== 23-Jan-2012::09:20:13 ===
Error in process <0.91.0> on node 'ecom@129.123.87.70' with exit
value: {function_clause,[{ecsmcons,handle,['GET',["static","ecsmcons.css"],{misultin_req,<0.84.0>,45080},9443],[{file,"/Users/zulu/0erl/ecsmcons/ecsmcons.erl"},{line,192}]}]}
=ERROR REPORT==== 23-Jan-2012::09:20:13 ===
module: misultin_http
line: 708
error in custom loop: {function_clause,
[{ecsmcons,handle,
['GET',
["static","jquery-1.6.4.min.js"],
{misultin_req,<0.84.0>,45080},
9443],
[{file,
"/Users/erl/ecsmcons/ecsmcons.erl"},
{line,192}]}]} serving request: {req,
{sslsocket,
new_ssl,
<0.83.0>},
ssl,
{127,0,0,1},
51593,
undefined,
keep_alive,
undefined,
{1,1},
'GET',
{abs_path,
"/static/jquery-1.6.4.min.js"},
[],
[{'Host',
"localhost:9443"},
{'Connection',
"keep-alive"},
{'Cache-Control',
"max-age=0"},
{'User-Agent',
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7
(KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7"},
{'Accept',
"/"},
{'Referer',
{'Accept-Encoding',
"gzip,deflate,sdch"},
{'Accept-Language',
"en-US,en;q=0.8"},
{'Accept-Charset',
"ISO-8859-1,utf-8;q=0.7,*;q=0.3"},
{'Cookie',
"ec_logged_in=true"}],
<<>>,false}
-wes
On Sat, Jan 21, 2012 at 6:13 PM, Roberto Ostinelli
reply@reply.github.com
wrote:
can't reproduce this at all.
. are you actually hitting https from your browser?
. can you run SSL without the static option?if so, please send me the error.
Reply to this email directly or view it on GitHub:
#93 (comment)
I also saw your example as running an app and tried adding:
{modules, [
ecsmcons,
misultin,
misultin_acceptor,
misultin_acceptors_sup,
misultin_http,
misultin_req,
misultin_server,
misultin_socket,
misultin_utility,
misultin_websocket,
misultin_ws
]},
i.e., the misultin stuff in the modules section of ecsmcons.app
-wes
On Sat, Jan 21, 2012 at 6:13 PM, Roberto Ostinelli
reply@reply.github.com
wrote:
can't reproduce this at all.
. are you actually hitting https from your browser?
. can you run SSL without the static option?if so, please send me the error.
Reply to this email directly or view it on GitHub:
#93 (comment)
please post complete code to reproduce this in a gist.
you have pasted only partial code which refers to undefined macros and other assumptions i'm unaware of. for instance, your https code here above does not specify a static option, so it's obviously not working.
for instance: have you actually tried specifying the static
options in your start_https
function?
thank you.
r.
I see the problem. I forgot to add {static, "/path/to/static"}. I
have it in my start_http section, but it was missing in start_https
section. Sorry for the hassle.
-wes
On Mon, Jan 23, 2012 at 11:24 AM, Roberto Ostinelli
reply@reply.github.com
wrote:
please post complete code to reproduce this in a gist.
you have pasted only partial code which refers to undefined macros and other assumptions i'm unaware of.
thank you.
r.
Reply to this email directly or view it on GitHub:
#93 (comment)