在apache配置中连接两个字符串

Blo*_*sie 8 apache string string-concatenation

在apache配置文件中,如何连接两个字符串?

例如:

"hello" + "world"
// "helloworld"
Run Code Online (Sandbox Code Playgroud)

为什么?

有人可能想要这样做来处理大标题,例如Content-Security-Policy下面是我的CSP的一个例子.您可以看到它的格式很好,可维护性,但在Headers中发送它时会有不需要的空格.

Header set Content-Security-Policy "\
;default-src\
    'self'\
;child-src\
    'self'\
;connect-src\
    'self'\
;font-src\
    'self'\
    https://*.gstatic.com\
;form-action\
    'self';\
;frame-ancestors\
    'self'\
;frame-src\
    'self'\
;img-src\
    'self'\
    https://www.google.com/s2/favicons\
    https://www.google-analytics.com\
    https://*.gstatic.com\
    https://*.googleapis.com\
;object-src\
    'none'\
;script-src\
    'self'\
    'unsafe-eval'\
    https://www.google-analytics.com\
    https://*.googleapis.com\
;style-src\
    'self'\
    'unsafe-inline'\
    https://*.googleapis.com\
;\
"
Run Code Online (Sandbox Code Playgroud)

小智 0

OIDCScope "profile email openid offline_access"
OIDCRemoteUserClaim  sub

<Location "/app2">
    AuthType openid-connect
    Require valid-user
    ProxyPass   "http://192.168.10.237/myapp"
    ProxyPassReverse  "http://192.168.10.237/myapp"

    RewriteEngine On
    RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER}] 
    RequestHeader set REMOTE_USER  %{PROXY_USER}e
</Location>

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

  • 谢谢并欢迎来到SO,您能详细说明一下这是如何回答这个问题的吗? (2认同)