How to configure Tomcat to use HTTP2 on Azure App Service? - spring-boot

I tried deploying a spring boot application as a war on an Azure App Service (Windows, java 8 , tomcat 8.5) .
It's a spring webflux application working with Server Sent Events so I need to have http2 support.
However even when http2 is enabled in the App Service I noticed that SSE is not working.
Looking in the logs I find that it is still using HTTP/1.1 under the covers.
From kudu D:\home\LogFiles\http\RawLogs
127.0.0.1 - - [12/Nov/2019:20:19:43 +0000] "GET /api/rooms/someroom/users/Gms_2290/info/subscribe HTTP/1.1" 200 5 144
127.0.0.1 - - [12/Nov/2019:20:19:44 +0000] "GET /api/rooms/someroom/users/Gms_2290/music/subscribe HTTP/1.1" 200 5 16
127.0.0.1 - - [12/Nov/2019:20:19:46 +0000] "GET /api/rooms/someroom/users/Gms_2290/heartbeat HTTP/1.1" 200 5 142
127.0.0.1 - - [12/Nov/2019:20:19:46 +0000] "GET /api/rooms/someroom/users/Gms_2290/info/subscribe HTTP/1.1" 200 5 19
127.0.0.1 - - [12/Nov/2019:20:19:48 +0000] "GET /api/rooms/someroom/users/Gms_2290/music/subscribe HTTP/1.1" 200 5 32
127.0.0.1 - - [12/Nov/2019:20:19:49 +0000] "GET /api/rooms/someroom/users/Gms_2290/heartbeat HTTP/1.1" 200 5 16
What I've tried
I tried playing with the java versions (switching between 8 and 9)
I tried playing with the Tomcat versions (8.5 and 9)
Linux angle
I first tried deploying the application to a Linux App Service (with java 8 and Tomcat 8.5)
That resulted in following errors from the log Stream
java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing
I suspect Tomcat might need some extra configuration in order to use the App Service SSL and thereby allowing http2, but I can't find a good way to configure the Tomcat used.
Any help is appreciated!

I verified that a Spring WebFlux application that uses SSE works fine in App Service Linux when run as a jar file (using the Java SE 8 offering with HTTP 1.1). So the issue you are experiencing seems to be related to Tomcat configuration.
For investigation, can you share the repro that works fine on Tomcat locally but fails when run on Tomcat in App Service?

Related

appharbor 502 Bad Gateway

when I go to my appharbor site I get a 502 Bad Gateway
in the logs I see
appharbor nginx xx.xx.xxx.xxx - "POST / HTTP/1.1" 502 150 "-" "Logplex/unknown" "source=nginx measure#http.response_time=0.000s measure#http.bytes.sent=300"
it was a problem on appharbors side

Laravel app not opening on given Elastic Beanstalk URL

I created new beanstalk environment PHP 7.3 running on 64bit Amazon Linux/2.9.6, Apache - with default PHP sample app. It's a classic load balancer type. But for now I have made it listening only to http at port 80. No https.
After deployment default PHP sample app runs fine on beanstalk environment url(cname) provided. Sample PHP app opens and because my environment is listening to just http so in browser I get "not secure" warning as normal behaviour but my Beanstalk URL is working so far and I see PHP sample app on browser.
Now I created fresh Laravel 7.x projects on my local machine. I tested and default "/" route points to welcome Laravel page. I deployed this sample Laravel project to my environment using EB on my Mac terminal.
Deploy is successful. I change the document root to "/public" in configuration because Laravel's index in inside public folder. Environment is in green health. Now I open Beanstalk URL and I see it's just taking a minute or so then it fails to load page saying "server where this page is located isn't responding" in Safari browser.
I checked my security group and it is listening to both http and ssh.
Final note: I have been doing this for long time. This is my first time experiencing this issue. Am I missing something?
Edit
I went inside Ec2 dashboard. I copied both Public DNS (IPv4) and IPv4 Public IP, tried accessing them in browser. It just takes time to connect and finish with "page not responding error".
My inbound rules for my security group:
HTTP TCP 80 0.0.0.0/0 -
SSH TCP 22 0.0.0.0/0 -
HTTPS TCP 443 0.0.0.0/0 -
Edit 2
Here is my access log from environment logs:
172.31.21.84 (103.86.57.43) - - [24/May/2020:18:34:31 +0000] "GET / HTTP/1.1" 301 278 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15"
103.86.57.58 (-) - - [24/May/2020:18:37:45 +0000] "GET / HTTP/1.1" 301 230 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15"
172.31.10.171 (195.154.94.244) - - [24/May/2020:18:45:10 +0000] "GET / HTTP/1.1" 301 228 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0"
I see that GET is called on / and http 301 is returned. It moved permanently. What does this mean?
I solved my issue by creating new fresh environment from eb cli in terminal using
eb create
Not sure why this worked but gave issue when creating environment from console dashboard.

Starting Realm Object server on AWS stalls

I've been trying to use Realm Object Server deployed on an Amazon ec2 instance, using the basic Amazon Ubuntu AMI (since the Realm AMI has ROS v.1.8.3).
To use the latest ROS (v2.x) I followed Realm's instructions to use curl -s https://raw.githubusercontent.com/realm/realm-object-server/master/install.sh | bash which appears to execute successfully. I follow that script's instructions to load nvm and use its latest version.
Then I run ros start. Here's what I get:
info: Loaded feature token capabilities=[Sync], expires=Wed Apr 19 2017 14:15:29 GMT+0000 (UTC)
info: Realm Object Server version 2.0.18 is starting
info: [sync] Realm sync server started ([realm-core-4.0.3], [realm-sync-2.1.4])
info: [sync] Directory holding persistent state: /home/ubuntu/data/sync/user_data
info: [sync] Operating mode: master_with_no_slave
info: [sync] Log level: info
info: [sync] Download log compaction is enabled
info: [sync] Max download size: 131072 bytes
info: [sync] Listening on 127.0.0.1:40134 (sync protocol version 22)
info: [http] 127.0.0.1 - GET /realms/files/%2F__wildcardpermissions HTTP/1.1 200 55 - 56.996 ms
info: [http] 127.0.0.1 - GET /realms/files/%2F__password HTTP/1.1 200 44 - 53.009 ms
info: [http] 127.0.0.1 - GET /realms/files/%2F__perm HTTP/1.1 200 40 - 9.402 ms
info: Autocreated admin user: realm-admin
info: Realm Object Server has started and is listening on http://0.0.0.0:9080
info: [http] 127.0.0.1 - GET /realms/files/%2F__admin HTTP/1.1 200 41 - 4.187 ms
info: [http] 127.0.0.1 - GET /realms/files/%2F__admin HTTP/1.1 200 41 - 29.902 ms
And then...nothing. It doesn't even get me back to my ubuntu#ip-XXX-XX-XX-XX: prompt. (It's possible that this is exactly what you'd expect but I'm pretty new to these kind of processes).
When I try to access my server in the browser (my DNS:9080) the browser says Cannot GET / and the CLI says info: [http] 96.2xx.xxx.xxx - GET / HTTP/1.1 404 139 - 0.521 ms
The security groups for my ec2 instance are:
HTTP / TCP / 80 / 0.0.0.0/0
SSH / TCP / 22 / 0.0.0.0/0
Custom UDP Rule / UDP / 9080 / 0.0.0.0/0
Custom TCP Rule / TCP / 9080 / 0.0.0.0/0
I'm stuck. What am I doing wrong? Thanks for your help.
The web based dashboard was part of ROS 1.x, but was replaced by Realm Studio in ROS 2.0.

Sinatra doesn't know this ditty even when default route is implemented with modular style

I'm running MacOS mavericks whith jruby and am trying to write a basic modular sinatra app. Here's what my config.ru looks like
require 'app/app'
run Sinatra::Application
I invoke it like this with rackup, you can see the 404 errors -
rackup -s puma -p 8080
Puma 2.10.2 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:8080
127.0.0.1 - - [17/Jan/2015:18:32:37 -0500] "GET / HTTP/1.1" 404 437 0.0290
127.0.0.1 - - [17/Jan/2015:18:32:37 -0500] "GET / HTTP/1.1" 404 437 0.0980
127.0.0.1 - - [17/Jan/2015:18:32:37 -0500] "GET /__sinatra__/404.png HTTP/1.1" 304 - 0.0120
127.0.0.1 - - [17/Jan/2015:18:32:37 -0500] "GET /__sinatra__/404.png HTTP/1.1" 304 - 0.0170
and this is what my source looks like -
➜ less app/app.rb
require 'sinatra/base'
class App < Sinatra::Base
get '/' do
"Hello World"
end
end
If I change the source to the classic way
➜ cat app/app.rb
require 'sinatra'
#class App < Sinatra::Base
get '/' do
"Hello World"
end
#end
and then invoke it like this, it works just fine -
➜ ruby app/app.rb
Puma 2.10.2 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:4567
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Puma
127.0.0.1 - - [17/Jan/2015:18:36:20 -0500] "GET / HTTP/1.1" 200 11 0.0250
I think I'm missing some very obvious config but can seem to figure out what that is, can someone let me know what I am missing? I can share more details about the environment if they are so required.
When you use the modular style, the Sinatra::Application app still exists, but usually nothing happens to it. In your config.ru you are running this (empty) app instead of your own. Simply change run Sinatra::Application to
run App

TeamCity agent returning 502 bad gateway

I'm getting this when starting up a TeamCity agent. To expose TC Server on EC2 I'm using Application request routing, Created a Server Farm and route 80 to 8080 internally. I can see mention of Port 9090 in below logs - I'm wondering if I would need to create a second application request route for 9090 - I haven't seen mention of this in any docs - anyone have XP with this?
[2014-02-09 07:31:35,994] INFO - buildServer.AGENT.registration - Registering on
server http://team.xxxx.com.au, AgentDetails{Name='WIN-IXXX',
AgentId=null, BuildId=null, AgentOwnAddress='null', AlternativeAddresses=
[10.xxx.xxx.xxx, 54.xxx.xxx.xxx], Port=9090, Version='27767', PluginsVersion='NA',
AvailableRunners=[], AvailableVcs=[], AuthorizationToken=''}
[2014-02-09 07:32:08,567] WARN - buildServer.AGENT.registration - Call
http://team.xxxx.com.au/RPC2 buildServer.registerAgent3:
org.apache.xmlrpc.XmlRpcClientException: Server returned incorrect status code: 502 Bad
Gateway
The TeamCity server needs to be able to open HTTP connections to the agent via the ownPort property of the buildAgent.properties file. That port is, by default, 9090.
You can read more here:
TeamCity - Setting Up Additional Build Agents

Resources