Hi all -

I am trying to add some headers to the exchange's "out" on all routes.
Specifically, I would like to add the following to support CORS:

    exch.out.headers['Access-Control-Allow-Origin'] = '*'
    exch.out.headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE,
GET, OPTIONS'
    exch.out.headers['Access-Control-Request-Method'] = '*'
    exch.out.headers['Access-Control-Allow-Headers'] = 'Origin,
X-Requested-With, Content-Type, Accept, Authorization, Cookie'

I do not understand how to do this for all routes. It works great when it is
done in a processor, but I obviously don't want to have to add these to each
processor. I tried intercepting the message using interceptFrom(), but the
headers so defined are not retained when the message is forwarded on to the
next destination. I also tried setting properties on the exchange, but this
presents problems when forming the response.

What is the best way to add HTTP headers to the messages returned from all
routes? Basically say "for every message, always add these headers as the
final step."

Tim



--
View this message in context: 
http://camel.465427.n5.nabble.com/Adding-HTTP-Headers-to-All-Jetty-Routes-tp5754265.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to