It's possible to hide the port number of a webapp (Tomcat)

Hi all:

I search over the forum but cannot find the answer (maybe I do not know the rights words to ask or search)…

I have an account running on a linux machine and apache and behind a tomcat server with webapplications. The thing is that I need to hide the port number on the app e.g. the app is running on https://somedomain.com:8443/someapp.

It is possible to hide the port via Cloudflare? in order to always show the url as https://somedomain.com/someapp???

Thanks,
Eduardo

Yep, that’s called ‘reverse proxy’

Your app will be available on port 80/443 and Apache, or nginx will proxy this requests to any port you like.

1 Like

Dear Mark:

Thanks a lot for your reply. But then your answer is that there is no option at Cloudflare to doing that reverse-proxy?

Thanks again,
Eduardo

This Workers code might do it. I think I stole it from @matteo

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

/**
 * Fetch and log a request
 * @param {Request} request
 */
async function changePort(request) {
  var newURL = new URL(request.url)
  newURL.port = '8443'

  return fetch(newURL, request)
}
2 Likes

Thief! :stuck_out_tongue_winking_eye:

2 Likes

So, then… thanks to both of you! :smile:

2 Likes

Nah, just me. I got rid of the evidence. You’re welcome!

1 Like

Thanks.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.