Report API - async option not returning appPath url.



  • I am trying to use the "options": {"reports": { "async": true }}. This does run and I get back an URL. The issue I am having is the URL does not adhere to the string that I have setup in my appPath configuration.

    example:

    I post an API request xxx.domain.com/reportserver\api\report with the body of {"reports": { "async": true }}.

    The URL I get back is https://xxx.azurewebsites.net/reportserver/reports/SOMEid/status'. This is the url to the web app service the docker container is hosted on.

    I thought I should get back a URL of xxx.domain.com/reportserver/reports/SOMEid/status.

    Should I be getting back the report appPath in the return URL?

    Thanks
    Wade



  • The appPath is the app subpath which is used to calculate the URL returned in the async report output Location header.

    When I have in appPath config "/myreports" and post to localhost. The Location header will be http://localhost:5488/myreports/reports/oU0NKlzyrI3fkXdv/status

    0_1711440538643_upload-05ee2d9a-6da8-443d-a00e-b4d65935f896

    Doesn't it work for you like that?

    The domain in the link is calculated from the request headers also based on the X-Forward-For headers which are typically added by load balancers/application gateways or application servers.
    If you post to the yourdomain.com but get xxx.azurewebsite.net back in the link, than it could be something wrong with the headers that reach the jsreport.



  • This does not seem to be the way it is working for me. This looks like it works for you because your example you are not changing the domain. Event though I am setting the headers at both the gateway or on the post it does not seem like the code is using them for generating the location.

    Setup.

    1. docker running on web app. url: https://myserver.azurewebsites.net
    2. Application gateway. This does a rewrite rule to forward this request from xxx.domain.com/reportserver/jsr to docker app (line 1). I did add a X-Forwarded-For hearder on gateway for domain(did not help) screenshot below.
    3. appPath to be /reportserver/jsr. This fixes the pathing in the browser and directs request to the correct url because of application gateway.

    Screen shot from jseport showing correct url for the api to post requests to.
    0_1711457934613_upload-f1395b0e-33d5-40a8-90d4-2577d4f63c67

    This is a screen shot from postman posting to the url. As you can see the location has the azure web app url along with the appPath.
    0_1711459932424_upload-ce7d1f5f-9156-4411-aef2-310a2ce2fbb2

    app gateway rewrite rule for X-Forwarded-For
    0_1711460742712_upload-8cbe4839-3e23-47c1-b09b-533229663505

    Additional attempt to apps the X-Forwarded-For and X-Forwarded-Host headers in the postman request.
    0_1711471519765_upload-3cdd7e54-bd58-4c06-b9f5-b99342d7cc2e

    Is there a way to see if the headers are making it to jsreport? Also is there a way to turn on a verbose logging to see what the app log is doing?



  • Yes, the problem is the most likely misconfiguration of your application gateway. I wasn't clear with the X-Forwarded-For. There are several headers every reverse proxy needs to send so the backend app can work properly.
    https://requestly.com/blog/what-are-x-forwarded-headers-and-why-it-is-used/

    The X-Forwarded-For should contain the client IP and the X-Forwarded-Host the original host. The correct X-Forwarded-Host should primarily help.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.