I am trying to use the rewrite engine of nginx to redirect requests.
On the same machine I have a Jetty running on port 8080, which is delivering some content.
I want to check if the content is available on Jetty otherwise I want to redirect it.
For that I have to locations added, one is used for the redirect on the Jetty and the other should check it.
location /nexus/ {
rewrite ^/nexus/(.*)$ http://A:8080/nexus/$1 permanent;
}
location ~* "^/releases/([a-z]*)/(.*)$" {
try_files /nexus/content/repositories nexus/content/repositories /nexus/content/;
# rewrite ^/releases/test/(.*)$ http://A:8080/nexus/content/repositories/Test/$2 break;
}
My idea was to use try_files, but the first parameters should be files or directories.
Is there any other method to test if an URL is accessible?
At the moment I am using Nginx for checking the reachable of the URL, perhaps I can better use Jetty, which is in front of Nexus.
Nginx was just a choice and if there are better possibilities, I am willing to switch. :)
Here some details about the environment: