Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openresty see .css/.js as lua file #25

Open
ovoshlook opened this issue Mar 27, 2016 · 1 comment
Open

openresty see .css/.js as lua file #25

ovoshlook opened this issue Mar 27, 2016 · 1 comment

Comments

@ovoshlook
Copy link

Hi. Lua module tries to enterpretate all css/js files as lua fies.

*95 failed to load external Lua file "/usr/local/openresty/nginx/html/mysite/themes/default/js/jquery-1.10.2.min.js":

My config

location ~^/mysite/(.+) {
default_type text/html;
lua_need_request_body on;
lua_code_cache off;
content_by_lua_file html/mysite/$1;
index index.lua index.lp;
}
location ~* ^.+.(?:css|eot|js|json|png|svg|ttf|woff)$ { }

@agentzh
Copy link
Member

agentzh commented Mar 27, 2016

@ovoshlook It's your responsibility to ensure that only valid Lua file paths are passed to content_by_lua_file. File name extensions never matter here. In your example you should put your second location before the 1st because the second should take precedence.

You can check out the openresty.org and openresty-survey web apps for real-world examples of mixing Lua powered locations and other static assets:

https://github.com/openresty/openresty.org

https://github.com/agentzh/openresty-survey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants