How can I stop initial http request after starting tomcat?

When running or debugging a web application intellij appears to do an initial http request as soon as the application is deployed. If an exception gets thrown during that initial http request intellij continues to make requests in an infinite loop (never even launches my browser) until I stop running/debugging the app server.

Is there anyway to stop intellij from making this initial http request when starting the app server? It never used to make an http request, this seems to have happened during an update in the last few months. I discovered this when testing some exception handling which I had tried 2-3 months ago and NEVER had an issue until now.

If you'd like to try and reproduce create a web app and have whatever servlet is handling a request to the context root throw an exception.

First request headers:

=== MimeHeaders ===
user-agent = IntelliJ IDEA
accept-encoding = gzip
cache-control = no-cache
pragma = no-cache
host = localhost:8080
accept = text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
connection = keep-alive

From my logs, as you can see there's a uuid assigned to each request and there are two distinct requests:

18:28:34.804 f80bbe85-de90-4a30-8584-b454e8dcc975 [http-apr-8080-exec-2] TRACE n.m.l.web.controllers.HomeController - index requested <---- this request from intellij, how do i stop it?
18:28:36.192 5b051989-0e53-49b6-ba65-fdfeb297580a [http-apr-8080-exec-7] TRACE n.m.l.web.controllers.HomeController - index requested <----- this request from my browser when intellij launches it

WORKAROUND - In your Run/Debug configs under Open Browser uncheck "After Launch". This stops the initial request. Makes me guess intellij is trying to check if the server is responding before launching the browser. Jetbrains please fix this.

1 comment
Comment actions Permalink

I can confirm that disabling the browser launch after deployment resolves the infinite loop problem.

Thanks for the workaround!


Please sign in to leave a comment.