I struggle with Portal for ArcGIS 10.3.1 to make directions working as expected. I created and exposed network service on ArcGIS Server (with Route layer enabled) and pasted the REST endpoint to corresponding parameter box on Utility Services page. The direction button has been enabled on Map Viewer and I can search for directions. However, the issue is that I receive only direction list without route on the map (which corresponds to params of the request sent to service - see below) and once I click on the direction, I receive error about NaN values of coordindates. On the map the scalebar appears with NaN values with map froozen.
Here is the query that is sent by Map Viewer. It differs from the request that is actually sent by ArcGIS Online MapViewer (POST with returnRoutes: "true")
Also, I checked NAService with some sample Esri JS API, and routing worked fine with output route visible.
Any ideas or clues?