Skip to content

Commit

Permalink
[#263] fix header setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbotsman committed Jan 9, 2019
1 parent f725f67 commit 37b1997
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions k8s/edge/nginx.conf.ltmpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ http {
-- arg[1] contains a chunk of response content
-- arg[2] is true if this is the last chunk

-- Model-Endpoint generation if it is missing
local model_endpoint = ngx.header["Model-Endpoint"]
if not model_endpoint then
model_endpoint = "default"
ngx.header["Model-Endpoint"] = model_endpoint
ngx.log(ngx.INFO, "Model Endpoint has been set to "..model_endpoint)
end

local edge = require("edge")
local chunkInfo = edge.catch_model_api_response_chunk("{{ model_endpoint.model_service.id }}", "{{ model_endpoint.model_service.version }}", ngx.arg[1], ngx.arg[2])

Expand Down Expand Up @@ -153,14 +161,6 @@ http {
ngx.log(ngx.INFO, "Request ID has been generated: "..requestID)
end

-- Model-Endpoint generation if it is missing
local model_endpoint = ngx.req.get_headers()["Model-Endpoint"]
if not model_endpoint then
model_endpoint = "default"
ngx.req.set_header("Model-Endpoint", model_endpoint)
ngx.log(ngx.INFO, "Model Endpoint has been set to "..model_endpoint)
end

ngx.header["Request-ID"] = requestID
}

Expand Down

0 comments on commit 37b1997

Please sign in to comment.