3

I am using mule studio, and I am trying out examples on it.

When ever i do a HTTP browser request, 2 requests come simultaneously, in which first one is /favicon.ico and the second request is the actual request.

My configuration XML is as follows.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd 
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
    <jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
    <flow name="Inititationflow" doc:name="Inititationflow">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8046" doc:name="HTTP"/>
        <echo-component doc:name="Echo"/>
        <jms:outbound-endpoint queue="BANK1" exchange-pattern="request-response" doc:name="JMS"/>
    </flow>
    <flow name="SampleTest" doc:name="SampleTest">
        <jms:inbound-endpoint queue="BANK1" connector-ref="Active_MQ" doc:name="JMS"/>
        <echo-component doc:name="Echo"/>
        <append-string-transformer message="AppendedPart" doc:name="Append String"/>
        <echo-component doc:name="Echo"/>
        <file:outbound-endpoint path="C:\Documents and Settings\balajik\Desktop" outputPattern="myfile.txt" doc:name="File"/>
    </flow>
</mule>

When ever I do a Http browser request: lh:8046/manasa-sundarraman

the flow gets executed twice as 2 requests arise. The requests are : 1) /favicon.ico 2) /manasa-sunderraman

My question is what is that /favicon.ico ? Why it is coming as a request ? How to avoid it ?

bali208
  • 2,257
  • 7
  • 40
  • 43
  • A favicon is the little website specific symbol you see in the browser. Look at the icon left to the title of the SO page. AFAIK it is the browser controlling the request for a favicon... – home Sep 14 '12 at 05:34
  • http://stackoverflow.com/questions/1321878/how-to-prevent-favicon-ico-requests – home Sep 14 '12 at 05:34

2 Answers2

6

I found out a way to clear favicon.ico request. If we add a filter in-between you will be able to filter the favicon.ico request.

<message-filter doc:name="Filter favicon">

<not-filter>

<wildcard-filter pattern="/favicon.ico" caseSensitive="true"/>

</not-filter>

</message-filter>

adding it after echoing the Http request solves the issue

bali208
  • 2,257
  • 7
  • 40
  • 43
3

MuleSoft basic tutorial gives a solution that will work with the new HTTP Listener in 3.6+:

<expression-filter expression="#[message.inboundProperties.'http.request.uri' != '/favicon.ico']" doc:name="Filter favicon"/>

For 3.5.0 and less:

<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Filter favicon"/>
aled
  • 21,330
  • 3
  • 27
  • 34