route.handler(routingContext -> {
response = routingContext.response();
HttpServerRequest req = routingContext.request();
req.bodyHandler(h -> {
logger.info("Handle body upload of size "+h.length());
});
response.end();
}); }}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/5417dc8b-1ac5-4f8b-921f-3bebd2e34b0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
upstream cloudbackup{
server 127.0.0.1:8443;
}
server {
listen 443;
server_name NAME_REMOVED;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains" always;
ssl on;
ssl_certificate /etc/nginx/certs/mycert.crt;
ssl_certificate_key /etc/nginx/certs/mykey.key;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers On;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_dhparam /usr/share/nginx/dhparams.pem;
client_max_body_size 0;
proxy_pass_request_headers on;
location /{ proxy_pass https://cloudbackup;}
}
My main verticle
import com.inhance.cloud.config.ConfigHelper;import com.inhance.cloud.handler.BackupListHandler;import com.inhance.cloud.handler.HMACAuthHandler;import com.inhance.cloud.handler.Handler;import com.inhance.cloud.handler.download.DownloadHandler;import com.inhance.cloud.handler.download.ThumbnailHandler;import com.inhance.cloud.handler.upload.UploadHandler;import io.vertx.core.AbstractVerticle;import io.vertx.core.http.HttpMethod;import io.vertx.core.http.HttpServerOptions;import io.vertx.core.logging.Logger;import io.vertx.core.logging.LoggerFactory;import io.vertx.core.net.PfxOptions;import io.vertx.ext.web.Router;
import java.time.LocalDateTime;import java.time.format.DateTimeFormatter;
/** * Created by patrick on 17/05/2016. */public class HttpVerticle extends AbstractVerticle {
Logger logger= LoggerFactory.getLogger(this.getClass());
@Override public void start() throws Exception {
Router router = Router.router(vertx);
Handler authHandler=new HMACAuthHandler(router.route()); authHandler.register();
Handler uploadHandler=new UploadHandler(router,"/:tagcode", HttpMethod.POST); uploadHandler.register();
vertx.createHttpServer().requestHandler(router::accept) .listen(ConfigHelper.httpPort());
logger.info("Server Started at "+ LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE));
}
}
My Upload Handler
package com.inhance.cloud.handler.upload;
import com.inhance.cloud.handler.AbstractHandler;
import io.vertx.core.MultiMap;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.ext.web.Router;
/**
* Created by patrick on 25/05/2016.
*/
public class UploadHandler extends AbstractHandler {
public UploadHandler(Router router, String path, HttpMethod method) {
super(router, path,method);
}
@Override
public void register() {
route.handler(routingContext -> {
response = routingContext.response();
String tagcode=routingContext.request().getParam("tagcode");
MultiMap headers = routingContext.request().headers();
HttpServerRequest req = routingContext.request();
req.bodyHandler(h -> {
logger.info("Handle body upload of size "+h.length());
});
response.end();
});
}
}
Without NGINX vertx handles the upload ok...
The problem I have with Vertx is around the cipher suites and the dhparam
Without setting those correctly I can't get IOS to accept the server as secure enough (mainly cipher suites)
package com.inhance.cloud.handler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.Router;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
/**
* Created by patrick on 19/05/2016.
*/
public abstract class AbstractHandler implements Handler {
protected Logger logger= LoggerFactory.getLogger(this.getClass());
protected HttpServerResponse response = null ;
protected Route route=null;
protected String path=null;
public AbstractHandler(Router router, String path, HttpMethod method) {
super();
route=router.route(path).method(method);
}
public AbstractHandler(Route route) {
super();
this.route=route;
}
protected String decodeKey(String param) {
String key="";
try {
key= URLDecoder.decode(param,"UTF8");
} catch (UnsupportedEncodingException e) {
logger.error(e.getMessage());
}
return key;
}
@Override
public abstract void register();
protected void writeJson(Object o) {
try {
String json;
if(o instanceof String){
json=(String)o;
}
else {
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
json = mapper.writeValueAsString(o);
}
response.headers().add("Content-Length",Integer.toString(json.length()));
response.headers().add("Content-Type","application/json");
response.write(json);
} catch (JsonProcessingException e) {
logger.error(e.getMessage(),e);
response.setStatusCode(500);
}
}
}
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/78475634-01bd-48d1-99a0-ac0aacc771ae%40googlegroups.com.