Showing posts with label WebCenter. Show all posts
Showing posts with label WebCenter. Show all posts

Friday, 26 June 2015

Forcing browsers to clear cache

When updating Production environments, there is usually an issue with browser cache. Some styles (css) are modified and you need to manually clear cache in your browser to check the result. This is fine for developers, but what about users? Are you going to tell all the users of a public website to manually clear browser cache?

This problem could be solved by disabling caching of the pages, in the page header or even in the template header, the following line can be added and browsers would not cache anything:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

However, an Oracle WebCenter application, as many others nowadays, relies heavily on cache to speed up loading processes, so this approach does not seem to be the best one.

My recommendation is to add a version parameter to the css file reference. Navigate to the place where the css include is located, usually in the page template, and add the following text: ?ver=1.1 The version value could be any of your choice.

For instance, in the WebCenter template file, the following line would force the client browsers to clear cache with the new modifications:

   <af:resource type="css" source="/../shared/css/portal/main.css?ver=1.1"/>

Next time the page is loaded in browser, it will load a new version of the style classes. This may checked using Firebug.



The best part is that you will not need to update the name of the css files, just ensure that include statements are updated when css are changed: 1.1, 1.2, 1.3, etc. It could also be applied to javascript files.

References



Friday, 20 March 2015

Preventing a Slowloris attack on WebCenter

Slowloris refers to a software program that opens several connections to a target web server and tries to keep them alive as long as possible, it will send part of requests periodically, without finishing them, so the server will let the connections alive, waiting for the request to be completed; eventually connection pool will be full and all the requests from users will be refused. Thus, it is a type of hacking attack which makes the web server to stop granting access to users.

For WebCenter implementations that are publicly accessible on the internet, it is important to prevent this type of attacks by configuring the web server. If you are using Oracle HTTP Server (OHS) which is based on Apache technology, the mod_reqtimeout module will solve this issue, as it sets a timeout and a minimum data rate for incoming requests.

In the OHS configuration file (httpd.conf), the following lines would be added:


  <IfModule reqtimeout_module>
#Minimum time to receive the request header is 10 seconds, allowing an increase of 1 second for every 500 bytes received, with a maximum of 40 seconds.
RequestReadTimeout header=10-40,minrate=500
#Minimum time to receive the request body is 20 seconds, increasing 1 second for every 500 bytes received. Limit is set by LimitRequestBody.
RequestReadTimeout body=20,minrate=500
  </IfModule>

After restarting OHS, changes would be applied.

So, is that all? Wait, it is not that easy, those values should be adjusted according to the loading time of the Portal pages and the network perfomance of the users.

References

 

Slowloris Definition
Understanding OHS Modules
Apache Module mod_reqtimeout

Tuesday, 13 January 2015

WebCenter Managed Servers taking too long to start up

Issue 

 

In an Oracle WebCenter Portal installation, the process of starting a managed server took around 40 minutes. Checking the start logs, there was a long time between the login and the following line.

 [EL Info]: 2013-11-06 19:35:25.773--ServerSession(645650875)--file:/SOFT/software/middleware/product/11.1.1/oracle_common/modules/oracle.jps_11.1.1/jps-internal.jar_JpsDBDataManagerV2_nonJtaDataSource=594822561 login successful
<Nov 6, 2013 7:58:58 PM CET> <Warning> <J2EE> <BEA-160140> <Unresolved optional package references (in META-INF/MANIFEST.MF): [Extension-Name:
oracle.apps.common.resource

 Also, in the managed server log, it was registered a big delay in database connections:

The thread is waiting for data from DataBase (as the admin as managed server show the same thread)
[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" id=23 idx=0x60 tid=24740 prio=5 alive, in native, daemon

 In order to find out the source of this problem, an AWR (Automatic Workload Repository) was requested to DBA. The report showed there was a single query that was taking 400 seconds to execute during server startup:

SELECT LOGID, DN, ACTION, APPLICATIONDN, ATTRNAME, CREATEDATE, ATTRVALUE, VERSION FROM JPS_CHANGELOG WHERE DN LIKE :1 ESCAPE :2 ORDER BY LOGID DESC

That query is against the JPS_CHANGELOG table in the OPSS (Oracle Platform Security Services) schema, where WebCenter security is located. It is a log where all the updates in WebCenter permissions are registered. The size of the table was checked, getting a result of 600.000 rows. Therefore, it needed to be purged.

Solution

 

Oracle explained how to maintain that table here. Basically, the following query should be executed in the OPSS schema:

SQL>delete from jps_changelog where createdate < (select(max(createdate) - 1) from jps_changelog);
SQL>Commit;

It is also recommended to execute the DMS_STATS package to gather database storage statistics.

After that purge:
  1. Start of the servers, including AdminServer, only took 4 minutes.
  2. JPS_CHANGELOG table size was 2.000 rows.
  3. AWR report showed that the query was taking only 40 seconds.
In case you are not sure if WebLogic security is maintained in databse, perform the following steps:
  1. Login to Enterprise Manager as administrator.
  2. Select WebLogic domain.
  3. Navigate to Security -> Security Provider Configuration.
  4. In the screen the database storage would appear.


Conclusion 

 

If WebCenter Portal has security delegated in an OPSS schema, it is important to program a periodic purge of the JPS_CHANGELOG table. Otherwise, platform performance would decrease progressively, showing an increase in the startup time of the servers.

References


Oracle® Fusion Middleware Application Security Guide 11g Release 1 (11.1.1):

Oracle Support Service Request:
SR 3-8069279071 : My custom portal node spends more 25 min to startup