Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10813

Host address ignored when creating a Restlet Server

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.18.3, 2.19.0
    • camel-restlet
    • None
    • Unknown

    Description

      The RestConfigurationDefinition allows a "host" to be specified while configuring the RouteBuilder. Unfortunately, the host is ignored while the Restlet Server is created. As a result, the server will always listen on all network interfaces.

      We would like to have Camel listening only on the local loopback interface for security reasons.

      Example of our code in the the RouteBuilder:

      public void configure() throws Exception {
      	restConfiguration()
      		.component("restlet")
      		.port(8103)
      		.host("127.0.0.1");
      
      // ...
      

      The debug log:

      org.apache.camel.component.restlet.RestletConsumer [DefaultConsumer.java:144] Starting consumer: Consumer[http://127.0.0.1:8103/api/status?restletMethods=GET]
      org.apache.camel.component.restlet.RestletComponent [RestletComponent.java:392] Setting parameters: [] to server: org.restlet.Server@e042c99
      org.apache.camel.component.restlet.RestletComponent [RestletComponent.java:396] Added server: 127.0.0.1:8103
      org.restlet.Component.Server [Slf4jLogger.java:132] Starting the internal [HTTP/1.1] server on port 8103
      

      I believe the problem is caused by following line which ignores the host parameter:
      https://github.com/apache/camel/blob/master/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java#L282

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              ludeks Ludek Stepan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: