extend/farwest

Static content is broken

Closed this issue · 2 comments

Farwest no longer serves static content.

Step to reproduce. Request the following URL: http://localhost:8080/static/farwest_ui/lib/jquery/jquery.json.js

Note: in the stack trace below, I use port 8888 to run my farwest instance, not the default 8080.

I believe the error is caused by changes in the Cowboy API introduced in ninenines/cowboy@6672ea0#diff-0aaa971e9e02fff59cf05fa815d7f9f6

14:42:52.828 [error] Error in process <0.228.0> on node 'farwest@127.0.0.1' with exit value: {[{reason,function_clause},{mfa,{cowboy_static,rest_init,2}},{stacktrace,[{cowboy_static,rest_init_opts,[{http_req,#Port<0.1305>,ranch_tcp,keepalive,<0.228.0>,<<3 bytes>>,'HTTP/1.1',{{127,0,0,1},59691},<<9 bytes>>,undefined,8888,<<44 bytes>>,[<<3 bytes>>,<<6 bytes>>,<<14 bytes>>],<<0 bytes>>,undefined,[],[{<<4 bytes>>,<<14 bytes>>},{<<6 bytes>>,<<3 bytes>>},{<<10 bytes>>,<<10 bytes>>},{<<6 bytes>>,<<65 bytes>>},{<<10 bytes>>,<<109 bytes>>},{<<15 bytes>>,<<5 bytes>>},{<<7 bytes>>,... 


14:42:52.830 [error] Ranch listener farwest_http had connection process started with cowboy_protocol:start_link/4 at <0.228.0> exit with reason: {[{reason,function_clause},{mfa,{cowboy_static,rest_init,2}},{stacktrace,[{cowboy_static,rest_init_opts,[{http_req,#Port<0.1305>,ranch_tcp,keepalive,<0.228.0>,<<"GET">>,'HTTP/1.1',{{127,0,0,1},59691},<<"localhost">>,undefined,8888,<<"/static/farwest_ui/lib/jquery/jquery.form.js">>,[<<"lib">>,<<"jquery">>,<<"jquery.form.js">>],<<>>,undefined,[],[{<<"host">>,<<"localhost:8888">>},{<<"accept">>,<<"*/*">>},{<<"connection">>,<<"keep-alive">>},{<<"cookie">>,<<"JSESSIONID=1w6dwmojasgxl126rwt0bcidlu; screenResolution=1920x1200">>},{<<"user-agent">>,<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71">>},{<<"accept-language">>,<<"en-us">>},{<<"referer">>,<<"http://localhost:8888/static/farwest_ui/lib/jquery/jquery.json.js">>},{<<"accept-encoding">>,<<"gzip, deflate">>}],[{<<"connection">>,[<<"keep-alive">>]}],undefined,[],waiting,undefined,<<>>,false,waiting,[],<<>>,#Fun},[{directory,{priv_dir,farwest_ui,<<"wwwroot">>}},{mimetypes,{{mimetypes,path_to_mimes},default}}]],[{file,"src/cowboy_static.erl"},{line,65}]},{cowboy_rest,upgrade,4,[{file,"src/cowboy_rest.erl"},{line,72}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,529}]}]},{req,[{socket,#Port<0.1305>},{transport,ranch_tcp},{connection,keepalive},{pid,<0.228.0>},{method,<<"GET">>},{version,'HTTP/1.1'},{peer,{{127,0,0,1},59691}},{host,<<"localhost">>},{host_info,undefined},{port,8888},{path,<<"/static/farwest_ui/lib/jquery/jquery.form.js">>},{path_info,[<<"lib">>,<<"jquery">>,<<"jquery.form.js">>]},{qs,<<>>},{qs_vals,undefined},{bindings,[]},{headers,[{<<"host">>,<<"localhost:8888">>},{<<"accept">>,<<"*/*">>},{<<"connection">>,<<"keep-alive">>},{<<"cookie">>,<<"JSESSIONID=1w6dwmojasgxl126rwt0bcidlu; screenResolution=1920x1200">>},{<<"user-agent">>,<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71">>},{<<"accept-language">>,<<"en-us">>},{<<"referer">>,<<"http://localhost:8888/static/farwest_ui/lib/jquery/jquery.json.js">>},{<<"accept-encoding">>,<<"gzip, deflate">>}]},{p_headers,[{<<"connection">>,[<<"keep-alive">>]}]},{cookies,undefined},{meta,[]},{body_state,waiting},{multipart,undefined},{buffer,<<>>},{resp_compress,false},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,#Fun}]},{opts,[{directory,{priv_dir,farwest_ui,<<"wwwroot">>}},{mimetypes,{{mimetypes,path_to_mimes},default}}]}],[{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,529}]}]}

Yep it didn't get updated to latest cowboy. You can use the 0.8.6 tag in cowboy if you want to test, farwest won't get updates until the switch to pgsql.

essen commented

Closing all tickets in this repo since there are no plans for this project under its current form.