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.
spring-mvc tomcat nginx websocket shiny
add a comment |
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.
spring-mvc tomcat nginx websocket shiny
add a comment |
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.
spring-mvc tomcat nginx websocket shiny
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
spring-mvc tomcat nginx websocket shiny
asked Nov 10 at 15:00
Harikrishna Yakkaluri
214
214
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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