I have a Spring Boot app running on Heroku and I am facing a weird problem.
If I try to access https://appname.herokuapp.com/authentication/token which is a POST request it works as expected with no problem.
However, I have configured my DNS and Heroku app to work on myxyzappdomain.com too and for most part it does. I can access the index.html page and all GET APIs. But, If I try to access any POST API like the one above (https://myxyzappdomain.com/authentication/token) I get a 405 error -
2020-08-17T19:47:31.039889+00:00 heroku[router]: at=info method=GET path="/authentication/token" host=www.myxyzappdomain.com request_id=92dbc99e-ed32-4643-abdb-7a0a8b6828f1 fwd="27.56.186.133,141.101.98.19" dyno=web.1 connect=6ms service=17ms status=405 bytes=287 protocol=http
2020-08-17T19:47:31.028327+00:00 app[web.1]: 2020-08-17 19:47:31.028 DEBUG 4 --- [io-57518-exec-6] o.s.web.servlet.DispatcherServlet : GET "/authentication/token", parameters={}
2020-08-17T19:47:31.031695+00:00 app[web.1]: 2020-08-17 19:47:31.031 DEBUG 4 --- [io-57518-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Using @ExceptionHandler com.abc.xyz.globalexceptions.GlobalExceptionHandler#handleException(Exception, WebRequest)
2020-08-17T19:47:31.031869+00:00 app[web.1]: 2020-08-17 19:47:31.031 WARN 4 --- [io-57518-exec-6] o.s.web.servlet.PageNotFound : Request method 'GET' not supported
2020-08-17T19:47:31.033581+00:00 app[web.1]: 2020-08-17 19:47:31.033 DEBUG 4 --- [io-57518-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : No match for [*/*], supported: []
2020-08-17T19:47:31.037345+00:00 app[web.1]: 2020-08-17 19:47:31.037 DEBUG 4 --- [io-57518-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
2020-08-17T19:47:31.037484+00:00 app[web.1]: 2020-08-17 19:47:31.037 DEBUG 4 --- [io-57518-exec-6] o.s.web.servlet.DispatcherServlet : Completed 405 METHOD_NOT_ALLOWED
Notice how it is trying to accept the POST request as a GET one and failing to do so. What is happening here?