RShiny Spring Integration Issue - Nginx not working correctly - HttpMediaTypeNotSupportedException









up vote
0
down vote

favorite












Nginx conf:



map $http_upgrade $connection_upgrade 
default upgrade;
'' close;


upstream websocket
server localhost:3305;


server
listen 8080;

location /myapp/insights/shiny-proxy/websocket/
proxy_pass http://websocket/;
proxy_redirect / $scheme://$http_host/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
proxy_buffering off;


location /
proxy_pass http://localhost:8070/;




Spring Mvc (4.2.4 version) Controller:



@RequestMapping(path = "/insights/shiny-proxy/**")
public ResponseEntity<String> mirrorRest(@RequestBody(required = false)
String body, HttpMethod method,
HttpServletRequest request) throws URISyntaxException
String path = StringUtils.removeStart(request.getRequestURI(),
"/myapp/insights/shiny-proxy");
URI uri = new URI(request.getScheme(), null, "localhost", ShinyServiceImpl.port, path, request.getQueryString(), null);

HttpHeaders headers = new HttpHeaders();
if (path.endsWith(".css.map"))
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
/*else
headers.setAccept(Arrays.asList(MediaType.ALL));
*/
HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
ResponseEntity<String> ret = null;
try
ret = restTemplate.exchange(uri, method, httpEntity, String.class);
catch (Exception e)
e.printStackTrace();


// System.out.println(ret);
// System.out.println("ResponseEntity headers: " + ret.getHeaders());
return ret;



JSP:



 <iframe src="shiny-proxy/" class="shinyFrame">
<object data="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame">
<embed src="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame" />
</object>
</iframe>


So When my application is started , RShiny will run on localhost:3305, so when localhost:8070/myapp/insights/index.html is opened, the iframe which has shiny url should display.
Right now am getting " HttpMediaTypeNotSupportedException: No Content Type Set" exception.



There are no acccess logs in Nginx, some times it shows upstream error or connection error like



"client timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while waiting for request, client: 127.0.0.1, server: 0.0.0.0:8080"


Please provides inputs where might i doing wrong. Thank You.










share|improve this question

























    up vote
    0
    down vote

    favorite












    Nginx conf:



    map $http_upgrade $connection_upgrade 
    default upgrade;
    '' close;


    upstream websocket
    server localhost:3305;


    server
    listen 8080;

    location /myapp/insights/shiny-proxy/websocket/
    proxy_pass http://websocket/;
    proxy_redirect / $scheme://$http_host/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_read_timeout 20d;
    proxy_buffering off;


    location /
    proxy_pass http://localhost:8070/;




    Spring Mvc (4.2.4 version) Controller:



    @RequestMapping(path = "/insights/shiny-proxy/**")
    public ResponseEntity<String> mirrorRest(@RequestBody(required = false)
    String body, HttpMethod method,
    HttpServletRequest request) throws URISyntaxException
    String path = StringUtils.removeStart(request.getRequestURI(),
    "/myapp/insights/shiny-proxy");
    URI uri = new URI(request.getScheme(), null, "localhost", ShinyServiceImpl.port, path, request.getQueryString(), null);

    HttpHeaders headers = new HttpHeaders();
    if (path.endsWith(".css.map"))
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
    /*else
    headers.setAccept(Arrays.asList(MediaType.ALL));
    */
    HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
    ResponseEntity<String> ret = null;
    try
    ret = restTemplate.exchange(uri, method, httpEntity, String.class);
    catch (Exception e)
    e.printStackTrace();


    // System.out.println(ret);
    // System.out.println("ResponseEntity headers: " + ret.getHeaders());
    return ret;



    JSP:



     <iframe src="shiny-proxy/" class="shinyFrame">
    <object data="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame">
    <embed src="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame" />
    </object>
    </iframe>


    So When my application is started , RShiny will run on localhost:3305, so when localhost:8070/myapp/insights/index.html is opened, the iframe which has shiny url should display.
    Right now am getting " HttpMediaTypeNotSupportedException: No Content Type Set" exception.



    There are no acccess logs in Nginx, some times it shows upstream error or connection error like



    "client timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while waiting for request, client: 127.0.0.1, server: 0.0.0.0:8080"


    Please provides inputs where might i doing wrong. Thank You.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Nginx conf:



      map $http_upgrade $connection_upgrade 
      default upgrade;
      '' close;


      upstream websocket
      server localhost:3305;


      server
      listen 8080;

      location /myapp/insights/shiny-proxy/websocket/
      proxy_pass http://websocket/;
      proxy_redirect / $scheme://$http_host/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
      proxy_buffering off;


      location /
      proxy_pass http://localhost:8070/;




      Spring Mvc (4.2.4 version) Controller:



      @RequestMapping(path = "/insights/shiny-proxy/**")
      public ResponseEntity<String> mirrorRest(@RequestBody(required = false)
      String body, HttpMethod method,
      HttpServletRequest request) throws URISyntaxException
      String path = StringUtils.removeStart(request.getRequestURI(),
      "/myapp/insights/shiny-proxy");
      URI uri = new URI(request.getScheme(), null, "localhost", ShinyServiceImpl.port, path, request.getQueryString(), null);

      HttpHeaders headers = new HttpHeaders();
      if (path.endsWith(".css.map"))
      headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
      /*else
      headers.setAccept(Arrays.asList(MediaType.ALL));
      */
      HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
      ResponseEntity<String> ret = null;
      try
      ret = restTemplate.exchange(uri, method, httpEntity, String.class);
      catch (Exception e)
      e.printStackTrace();


      // System.out.println(ret);
      // System.out.println("ResponseEntity headers: " + ret.getHeaders());
      return ret;



      JSP:



       <iframe src="shiny-proxy/" class="shinyFrame">
      <object data="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame">
      <embed src="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame" />
      </object>
      </iframe>


      So When my application is started , RShiny will run on localhost:3305, so when localhost:8070/myapp/insights/index.html is opened, the iframe which has shiny url should display.
      Right now am getting " HttpMediaTypeNotSupportedException: No Content Type Set" exception.



      There are no acccess logs in Nginx, some times it shows upstream error or connection error like



      "client timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while waiting for request, client: 127.0.0.1, server: 0.0.0.0:8080"


      Please provides inputs where might i doing wrong. Thank You.










      share|improve this question













      Nginx conf:



      map $http_upgrade $connection_upgrade 
      default upgrade;
      '' close;


      upstream websocket
      server localhost:3305;


      server
      listen 8080;

      location /myapp/insights/shiny-proxy/websocket/
      proxy_pass http://websocket/;
      proxy_redirect / $scheme://$http_host/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
      proxy_buffering off;


      location /
      proxy_pass http://localhost:8070/;




      Spring Mvc (4.2.4 version) Controller:



      @RequestMapping(path = "/insights/shiny-proxy/**")
      public ResponseEntity<String> mirrorRest(@RequestBody(required = false)
      String body, HttpMethod method,
      HttpServletRequest request) throws URISyntaxException
      String path = StringUtils.removeStart(request.getRequestURI(),
      "/myapp/insights/shiny-proxy");
      URI uri = new URI(request.getScheme(), null, "localhost", ShinyServiceImpl.port, path, request.getQueryString(), null);

      HttpHeaders headers = new HttpHeaders();
      if (path.endsWith(".css.map"))
      headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
      /*else
      headers.setAccept(Arrays.asList(MediaType.ALL));
      */
      HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
      ResponseEntity<String> ret = null;
      try
      ret = restTemplate.exchange(uri, method, httpEntity, String.class);
      catch (Exception e)
      e.printStackTrace();


      // System.out.println(ret);
      // System.out.println("ResponseEntity headers: " + ret.getHeaders());
      return ret;



      JSP:



       <iframe src="shiny-proxy/" class="shinyFrame">
      <object data="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame">
      <embed src="shiny-proxy/" type="text/html; charset=utf-8" class="shinyFrame" />
      </object>
      </iframe>


      So When my application is started , RShiny will run on localhost:3305, so when localhost:8070/myapp/insights/index.html is opened, the iframe which has shiny url should display.
      Right now am getting " HttpMediaTypeNotSupportedException: No Content Type Set" exception.



      There are no acccess logs in Nginx, some times it shows upstream error or connection error like



      "client timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while waiting for request, client: 127.0.0.1, server: 0.0.0.0:8080"


      Please provides inputs where might i doing wrong. Thank You.







      spring-mvc tomcat nginx websocket shiny






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 15:00









      Harikrishna Yakkaluri

      214




      214



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240198%2frshiny-spring-integration-issue-nginx-not-working-correctly-httpmediatypenot%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240198%2frshiny-spring-integration-issue-nginx-not-working-correctly-httpmediatypenot%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto