Apache SSL proxy configuration for Java Grizzly server - Telegram webhook

Need help with SSL proxy setup for Telegram bot

I’m building a Telegram bot using Java and want to use Grizzly as my HTTP server. I have Apache2 running on my Debian server with a self-signed SSL certificate working fine. When I visit the secure URL, Apache loads correctly.

My goal is to have Apache handle the SSL termination and proxy incoming HTTPS POST requests (which contain JSON payloads from Telegram webhooks) to my Grizzly server running on a different port.

What’s the best way to configure Apache as an SSL proxy to forward these requests to Grizzly? I’m not sure about the exact Apache configuration needed to make this proxy setup work properly with my Java application.

just dealt with this last week. don’t forget to restart apache after enabling proxy modules - it won’t work otherwise. what tripped me up was the firewall blocking connections between apache and grizzly, so check your local port isn’t blocked. also, telegram webhooks need a 200 response within 60 seconds, so test grizzly’s performance before going live.

It’s pretty straightforward once you sort out the modules. Besides what olivias mentioned, don’t forget ProxyPassReverse - it fixes the response headers when Grizzly sends stuff back through Apache. I had issues where my bot responses weren’t hitting Telegram until I got this right. Here’s what caught me: Telegram expects your webhook to respond fast, so make sure Grizzly can handle the load. Also throw ProxyTimeout 30 in your Apache config to prevent hanging connections that mess with future webhook deliveries. Turn on Apache’s proxy logs temporarily so you can see what’s actually getting forwarded to Grizzly. Saved me hours debugging why some webhook events weren’t processing.

I had a similar issue while setting up my own Telegram bot with Grizzly. To get Apache to correctly act as an SSL proxy, ensure that both mod_proxy and mod_proxy_http are enabled in your Apache configuration. In the relevant SSL VirtualHost section, you’ll want to include directives like ProxyPass /webhook/ http://localhost:8080/webhook/ and ProxyPassReverse /webhook/ http://localhost:8080/webhook/, ensuring you replace ‘8080’ with the appropriate port for your Grizzly server. It’s also crucial to add ProxyPreserveHost On to retain the original host information. Regarding Content-Type for the JSON payloads, those should typically pass through automatically; however, it’s safer to verify that. Lastly, don’t forget to test your setup with Telegram’s webhook validator to confirm everything is functioning as expected.