播放2.6,URI长度超过配置的2048个字符的限制

时间:2017-07-22 01:18:10

标签: playframework-2.6

我正在尝试将Play 2.5版本迁移到2.6.2。我一直得到URI长度超过错误。任何人都知道如何覆盖它?

我在Akka设置下尝试过,但仍然没有运气。

play.server.akka{
http.server.parsing.max-uri-length = infinite
http.client.parsing.max-uri-length = infinite      
http.host-connection-pool.client.parsing.max-uri-length = infinite      
http.max-uri-length = infinite
max-uri-length = infinite
}

3 个答案:

答案 0 :(得分:4)

只需添加

akka.http {
  parsing {
    max-uri-length = 16k
  }
}

application.conf。前缀play.server仅用于Akka-HTTP集成到Playframework中的一小部分便利功能,例如: play.server.akka.requestTimeout。这些内容记录在Configuring the Akka HTTP server backend文档中。

答案 1 :(得分:0)

由于报头长度超过默认的8 KB(8192),我遇到了错误。在build.sbt中添加了以下内容,它对我有用:D

dataURL <- "https://pastebin.com/raw/whLr21ZA"
expData.df<- read.table(dataURL,header=TRUE,sep="\t",stringsAsFactors=FALSE)
expData.mat <- as.matrix(expData.df[-c(1)])
rownames(expData.mat) <- expData.df$Mol
useT.mat <- t(expData.mat)
mat_list = list(a = useT.mat)
dend_list = list(a = as.dendrogram(hclust(dist(t(mat_list[["a"]])))) )
col_fun = colorRamp2(breaks= c(-13.288,-5.265,-6.674,-2.544,4.694,5.000), colors = c("blue4","lightblue","yellow","orange","orangered", "red"),transparency = .4)
factors = rep(letters[1], times = c( dim(useT.mat)[2] ))

circos.par(cell.padding = c(0, 0, 0, 0), gap.degree = 15)
circos.initialize(factors, xlim =cbind(c(0), table(factors)))

circos.track(ylim = c(0, 1), bg.border = NA, panel.fun = function(x, y) {
    sector.index = CELL_META$sector.index
    m = mat_list[[sector.index]]
    dend = dend_list[[sector.index]]

    m2 = m[, order.dendrogram(dend)]
    col_mat = col_fun(m2)
    nr = nrow(m2)
    nc = ncol(m2)
    for(i in 1:nr) {
        circos.rect(1:nc - 1, rep(nr - i, nc), 
            1:nc, rep(nr - i + 1, nc), 
            border = col_mat[i, ], col = col_mat[i, ])
    }
})
#Dendrogram
max_height = max(sapply(dend_list, function(x) attr(x, "height")))
circos.track(ylim = c(0, max_height), bg.border = NA, track.height = 0.3, 
    panel.fun = function(x, y) {

        sector.index = get.cell.meta.data("sector.index")
        dend = dend_list[[sector.index]]
        circos.dendrogram(dend, max_height = max_height)
})
circos.clear()

如果其他选项不起作用,您可以尝试类似的uri长度

答案 2 :(得分:0)

这花了我很长时间才弄清楚。在文档中以某种方式没有

这里有一个代码段(已确认可在play 2.8上使用)放入您的application.conf中,该代码段也可以通过环境变量进行配置,并且适用于 BOTH 开发和生产模式:

# Dev Mode
play.akka.dev-mode.akka.http.parsing.max-uri-length = 16384
play.akka.dev-mode.akka.http.parsing.max-uri-length = ${?PLAY_MAX_URI_LENGTH}

# Prod Mode
akka.http.parsing.max-uri-length = 16384
akka.http.parsing.max-uri-length = ${?PLAY_MAX_URI_LENGTH}

然后,您可以编辑配置,也可以使用已部署的应用程序(只需设置PLAY_MAX_URI_LENGTH进行编辑,并且可以动态配置该配置,而无需修改命令行参数。

env PLAY_MAX_URI_LENGTH=16384 sbt run