jaystack / odata-v4-server

With JayStack OData v4 Server you can build your own data endpoints without the hassle of implementing any protocol-level code. This framework binds OData v4 requests to your annotated controller functions, and compiles OData v4 compatible response. Clients can access services through OData-compliant HTTP requests. We recommend the JayData library for consuming OData v4 APIs.
https://jaystack.com/products/jaystack-odata-v4-server/
75 stars 55 forks source link

Add ability to override protocol #48

Open monty0157 opened 4 years ago

monty0157 commented 4 years ago

The module currently cleverly uses the value of req.secure to determine whether to use http or https for the OData records. However, if your OData service is running behind a loadbalancer that terminates TLS, then http will always be used. You therefore currently have to have port 80 open to use the OData service in Excel or Power BI, which is not allowed in certain companies for security reasons.

This PR therefore adds the ability to override the protocol by passing in the value of the protocol when creating the server, thus allowing the OData records to be served with https, even if TLS was previously terminated.

I hope the extra protocol options doesn't break the structure of your code. If you want to have this fix done differently to be able to merge it, then let me know or feel free to change the code.

mayrbenjamin92 commented 4 years ago

+1