Skip to content

Invalid URL Prefix Error #309

@xemose

Description

@xemose

Problem: The following error shows up when the waf is executed through waf:exec(). It was working before, but something changed and it now gives out a 500 internal server error.

Error Log
2018/10/07 20:32:42 [error] 6830#0: *1 invalid URL prefix in "http://", client: 192.168.1.225, server: $http_host, request: "GET / HTTP/1.1", host: "test.beta:8080"

Edit: Found a more concise error log. There is a previous issue for this but there is no solution for it.

2018/10/07 21:29:50 [error] 636#0: *1 lua entry thread aborted: runtime error: /etc/nginx/library/resty/waf/load_ac.lua:76: attempt to call upvalue 'ac_create' (a nil value)
stack traceback:
coroutine 0:
	/etc/nginx/library/resty/waf/load_ac.lua: in function 'create_ac'
	/etc/nginx/library/resty/waf/operators.lua:259: in function </etc/nginx/library/resty/waf/operators.lua:252>
	/etc/nginx/library/resty/waf.lua:297: in function '_process_rule'
	/etc/nginx/library/resty/waf.lua:543: in function 'exec'
	access_by_lua(proxy.conf:29):8: in function <access_by_lua(proxy.conf:29):1>, client: 192.168.1.225, server: $http_host, request: "GET / HTTP/1.1", host: "test.beta:8080", referrer: "http://test.beta:8080/"

Installation Process: Used luarocks

Configuration:

server {
    set $template_location /html;
	listen 192.168.1.232:8080;
	server_name $http_host;
	
	location / {
		set $backend "";
		default_type text/html;
		access_by_lua_block {
			local template = require "resty.template"
			local ck = require "resty.cookie"
			local lua_resty_waf = require "resty.waf"
			local waf = lua_resty_waf:new()
        	         waf:set_option("debug", true)
			waf:set_option("mode", "ACTIVE")
			waf:exec()
			local cookie, err = ck:new()
			if not cookie then
		                ngx.log(ngx.ERR, err)
				return
			end

			local verify, err = cookie:get("fireball")
			if verify then
				ngx.var.backend = "192.168.1.247"
			else
				template.render("verify.html", { website = ngx.var.host })
			end
		}
		proxy_pass http://$backend;
		proxy_set_header Host $host;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions