0

I know how to check if a url exists in using, see following posts.

Check if file exists on remote server using its URL

How to check if a URL exists or returns 404 with Java?

The problem is if a ssl https url exists, i tried all suggestions in the above threads, and while they work fine on normal http urls, none of them work on a https file.

Is it not possible?

Suggestions?

Community
  • 1
  • 1
Marcel Panse
  • 572
  • 1
  • 6
  • 13
  • 2
    How does it not work? Do you get authentication exceptions? If so, the server might just not tell you whether the requested resource exists or not, since that's information you're not authorized to have. – Thomas Oct 26 '11 at 10:57
  • 1
    It should work just the same. But the https connection might throw additional exceptions (e.g. SSLHandshake failed or hostname does not match the certificate). You can avoid these checks, but this can lead to other problems. – Ulf Jaehrig Oct 26 '11 at 11:04

1 Answers1

1

The normal methods that work with "http:" URLs should also work with "https:" URLs. If they don't, then the probable cause is not the code but something else:

  • The URLs might use a SSL certificate that is not acceptable to Java. It might be self-signed, it might use a root certificate that your JVM's certificate store doesn't include. It might be the wrong certificate for the site.

  • It might be a problem with your JVM's proxy configurations. (You can't proxy HTTPS).

  • The remote site might simply not be listening for HTTPS requests.

  • The remote site might filter HTTPS requests based on header fields; e.g. the agent header.

To help us help you find the problem:

  • tell us what URL you are trying to access,
  • tell us if the URL works for you using a web browser,
  • if there are exceptions, show us the stacktraces.
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216