Skip to content

Change the Urls of OData V4 when running behind reverse proxy #1817

Open
@kvskranthikumar

Description

@kvskranthikumar

With DotNet Core WebAPI I would like to change the OData URLs in the output. API is running behind a reverse proxy and I want all the URLs in the OData output to be relative to the gateway.

Current Output from API -

{
    "@odata.type": "#Company.Users.Models.User",
    "@odata.id": "http://localhost:7004/Users/api/v1/odata/Users(1)",
    "@odata.editLink": "http://localhost:7004/Users/api/v1/odata/Users(1)",
    "userId": 1,
    "userName": "Test",
    "email": null,
    "isWindowsUser": false,
    "isLocked": false,
    "[email protected]": "#DateTimeOffset",
    "createDate": "2019-05-20T07:46:59.187+05:30",
    "[email protected]": "#DateTimeOffset",
    "lastLoginDate": "2019-05-22T15:52:11.437+05:30",
    "lastPwdChangeDate": null,
    "failedPwdAttemptCount": null,
    "failedPwdAttemptWinStart": null,
    "failedPwdAnswerAttemptCount": null,
    "failedPwdAnswerAttemptWinStart": null,
    "lastLockedOutDate": null,
    "ipAddress": null,
    "userComment": "Test User",
    "[email protected]": "http://localhost:7004/Users/api/v1/odata/Users(1)/userRoles/$ref",
    "[email protected]": "http://localhost:7004/Users/api/v1/odata/Users(1)/userRoles"
}

Change the url - "http://localhost:7004/Users/api/v1/odata" to "http://localhost:7000/Users"
I have already gone through this link - https://issues.oasis-open.org/browse/ODATA-527 but this doesn't provide details on how to make it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions