Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove wrapper in log #487

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class QuinoaDevProxyHandler implements Handler<RoutingContext> {
private final ClassLoader currentClassLoader;
private final QuinoaHandlerConfig config;

QuinoaDevProxyHandler(final QuinoaHandlerConfig config, final Vertx vertx, String host, int port, boolean websocket) {
QuinoaDevProxyHandler(final QuinoaHandlerConfig config, final Vertx vertx, String host, int port,
boolean websocket) {
this.host = host;
this.port = port;
this.client = WebClient.create(vertx);
Expand Down Expand Up @@ -85,7 +86,8 @@ private void handleHttpRequest(final RoutingContext ctx, final String resourcePa
final String uri = computeResourceURI(resourcePath, request);

// Workaround for issue https://github.com/quarkiverse/quarkus-quinoa/issues/91
// See https://www.npmjs.com/package/connect-history-api-fallback#htmlacceptheaders
// See
// https://www.npmjs.com/package/connect-history-api-fallback#htmlacceptheaders
// When no Accept header is provided, the historyApiFallback is disabled
headers.remove("Accept");
// Disable compression in the forwarded request
Expand Down Expand Up @@ -132,9 +134,7 @@ private void forwardError(AsyncResult<HttpResponse<Buffer>> event, int statusCod

private void forwardResponse(AsyncResult<HttpResponse<Buffer>> event, HttpServerRequest request, RoutingContext ctx,
String resourcePath) {
if (LOG.isDebugEnabled()) {
LOG.debugf("Quinoa is forwarding: '%s'", request.uri());
}
LOG.debugf("Quinoa is forwarding: '%s'", request.uri());
final HttpServerResponse response = ctx.response();
for (String header : HEADERS_TO_FORWARD) {
response.headers().add(header, event.result().headers().getAll(header));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,25 @@ public Handler<RoutingContext> quinoaHandler(final QuinoaHandlerConfig handlerCo
static String resolvePath(RoutingContext ctx) {
return (ctx.mountPoint() == null) ? ctx.normalizedPath()
: ctx.normalizedPath().substring(
// let's be extra careful here in case Vert.x normalizes the mount points at some point
// let's be extra careful here in case Vert.x normalizes the mount points at
// some point
ctx.mountPoint().endsWith("/") ? ctx.mountPoint().length() - 1 : ctx.mountPoint().length());
}

static boolean isIgnored(final String path, final List<String> ignoredPathPrefixes) {
if (ignoredPathPrefixes.stream().anyMatch(path::startsWith)) {
if (LOG.isDebugEnabled()) {
LOG.debugf("Quinoa is ignoring path (quarkus.quinoa.ignored-path-prefixes): " + path);
}
LOG.debugf("Quinoa is ignoring path (quarkus.quinoa.ignored-path-prefixes): " + path);
return true;
}
return false;
}

static void compressIfNeeded(QuinoaHandlerConfig config, RoutingContext ctx, String path) {
if (config.enableCompression && isCompressed(config, path)) {
// VertxHttpRecorder is adding "Content-Encoding: identity" to all requests if compression is enabled.
// Handlers can remove the "Content-Encoding: identity" header to enable compression.
// VertxHttpRecorder is adding "Content-Encoding: identity" to all requests if
// compression is enabled.
// Handlers can remove the "Content-Encoding: identity" header to enable
// compression.
ctx.response().headers().remove(HttpHeaders.CONTENT_ENCODING);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public void handle(RoutingContext ctx) {
}
String path = resolvePath(ctx);
if (!Objects.equals(path, "/") && !isIgnored(path, config.ignoredPathPrefixes)) {
if (LOG.isDebugEnabled()) {
LOG.debugf("Quinoa is re-routing SPA request '%s' to '/'", ctx.normalizedPath());
}
LOG.debugf("Quinoa is re-routing SPA request '%s' to '/'", ctx.normalizedPath());
ctx.reroute(ctx.mountPoint() != null ? ctx.mountPoint() : "/");
} else {
next(currentClassLoader, ctx);
Expand Down