{"action":"created","issue":{"url":"https://api.github.com/repos/bungle/lua-resty-template/issues/25","repository_url":"https://api.github.com/repos/bungle/lua-resty-template","labels_url":"https://api.github.com/repos/bungle/lua-resty-template/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/bungle/lua-resty-template/issues/25/comments","events_url":"https://api.github.com/repos/bungle/lua-resty-template/issues/25/events","html_url":"https://github.com/bungle/lua-resty-template/issues/25","id":209757036,"number":25,"title":"wrong template returned when using multiple server blocks","user":{"login":"craveica","id":6016030,"avatar_url":"https://avatars.githubusercontent.com/u/6016030?v=3","gravatar_id":"","url":"https://api.github.com/users/craveica","html_url":"https://github.com/craveica","followers_url":"https://api.github.com/users/craveica/followers","following_url":"https://api.github.com/users/craveica/following{/other_user}","gists_url":"https://api.github.com/users/craveica/gists{/gist_id}","starred_url":"https://api.github.com/users/craveica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craveica/subscriptions","organizations_url":"https://api.github.com/users/craveica/orgs","repos_url":"https://api.github.com/users/craveica/repos","events_url":"https://api.github.com/users/craveica/events{/privacy}","received_events_url":"https://api.github.com/users/craveica/received_events","type":"User","site_admin":false},"labels":[{"id":81888261,"url":"https://api.github.com/repos/bungle/lua-resty-template/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-23T13:11:06Z","updated_at":"2017-02-24T11:43:36Z","closed_at":null,"body":"```\r\nserver {\r\n    server_name a;\r\n    set $template_root /etc/nginx/sites/a;\r\n    location / {\r\n        content_by_lua_file '/etc/nginx/sites/a/index.lua';\r\n    }\r\n}\r\n\r\nserver {\r\n    server_name b;\r\n    set $template_root /etc/nginx/sites/b;\r\n    location / {\r\n        content_by_lua_file '/etc/nginx/sites/b/index.lua';\r\n    }\r\n}\r\n\r\nindex.lua:\r\nlocal template = require \"resty.template\"\r\ntemplate.render(\"test.html\")\r\n\r\n/etc/nginx/sites/a/test.html:\r\na\r\n\r\n/etc/nginx/sites/b/test.html\r\nb\r\n\r\n--------------------------------\r\n$ curl https://b/ ; curl https://a/\r\nb\r\na\r\n$ curl https://b/ ; curl https://a/\r\nb\r\nb <-- wrong\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bungle/lua-resty-template/issues/comments/282272523","html_url":"https://github.com/bungle/lua-resty-template/issues/25#issuecomment-282272523","issue_url":"https://api.github.com/repos/bungle/lua-resty-template/issues/25","id":282272523,"user":{"login":"craveica","id":6016030,"avatar_url":"https://avatars.githubusercontent.com/u/6016030?v=3","gravatar_id":"","url":"https://api.github.com/users/craveica","html_url":"https://github.com/craveica","followers_url":"https://api.github.com/users/craveica/followers","following_url":"https://api.github.com/users/craveica/following{/other_user}","gists_url":"https://api.github.com/users/craveica/gists{/gist_id}","starred_url":"https://api.github.com/users/craveica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craveica/subscriptions","organizations_url":"https://api.github.com/users/craveica/orgs","repos_url":"https://api.github.com/users/craveica/repos","events_url":"https://api.github.com/users/craveica/events{/privacy}","received_events_url":"https://api.github.com/users/craveica/received_events","type":"User","site_admin":false},"created_at":"2017-02-24T11:43:36Z","updated_at":"2017-02-24T11:43:36Z","body":"@bungle \r\nYou're right. The cache key is set to 'test.html' for both. As a workaround, I have to pass my own key to template.render.\r\n```\r\ntemplate.render(\"test.html\", {}, ngx.var.template_root .. \"test.html\")\r\n```\r\nI still think this should be fixed.\r\n"}}
{"actor":{"display_login":"craveica"}}