2014-10-16 128 views
0

我想在我的應用程序Web服務器端設置響應標頭,以使我的cookie「安全」和「安全」。如何設置IBM HTTP Server的響應標頭

可以指導我如何實現這一目標。 如果我們進行這些更改,是否會對在HTTPS上運行的應用程序產生任何影響。

回答

1

IHS(這是基於Apache)的httpd.conf

<Location /your-app> 
    SetHandler server-status 
    Order deny,allow 
    Allow from all 
    Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure 
</Location> 

其中/你 - 應用程序 - 您的應用程序

的背景根源是:

Servers > Server Types > WebSphere application servers > YOUR-APP > Web Container Settings > Web container: Custom Properties> New 
Name: com.ibm.ws.webcontainer.HTTPOnlyCookies; 
Value: JsessionID 

Servers > Server Types > WebSphere application servers > YOUR-APP > Session management > Enable Cookies link. Requires use of SSL protocol. 

可能有一些(取決於它是如何開發的)

例如:

# 
# Allow server status reports generated by mod_status, 
# with the URL of http://servername/server-status 
# Change the ".example.com" to match your domain to enable. 
# 
<IfModule mod_status.c> 
<Location /server-status> 
    SetHandler server-status 
    Order deny,allow 
    Deny from all 
# Add an "Allow from" directive to provide access to the server status page. 
# 
# Examples: 
# 
# 1. Allow any client with hostname *.example.com to view the page. 
# 
# Allow from .example.com 
# 
# 2. Allow the local machine to view the page using the loopback address. 
# 
# Allow from 127.0.0.1 
# 
# 3. Allow any machine on the local network to view the page. 
# 
# Allow from 192.168.1 
</Location> 
</IfModule> 

... 

##### NON-DEFAULT ##### 

<Location /xxx> 
    SetHandler server-status 
    Order deny,allow 
    Allow from all 
    Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure 
</Location> 

<VirtualHost *:80> 
</VirtualHost> 

LoadModule ibm_ssl_module modules/mod_ibm_ssl.so 
Listen 443 
Listen 4469 

<VirtualHost *:443 *:4469> 
SSLEnable 
Keyfile /root/keys/web1-key-db.kdb 
SSLStashfile /root/keys/web1-key-db.sth 
</VirtualHost> 

#####/NON-DEFAULT ##### 

... 
+0

我得到了這個Header編輯Set-Cookie ^(。*)$ $ 1; HttpOnly; Secure在httpd.cong中加入.. n其不工作。我的qsn是:是否必須在標籤內添加標籤。 N如果是,那麼我是否需要再次複製這些n然後執行,或者將其添加到現有的中。你能否在這裏給我一個例子。 – Onki 2014-10-17 09:37:37

+0

您是否也可以引導我可以參考的任何文檔。我想谷歌很多關於這個,但我沒有得到太多/準確的細節。 – Onki 2014-10-17 09:45:40

+0

@ user3610891我添加了一個例子。我們調查了幾年前,所以我不記得任何文檔的鏈接。你有應用程序服務器嗎?在這種情況下,您需要在管理控制檯中進行一些更改。 – Multisync 2014-10-17 10:02:49