简体   繁体   中英

Setting endpoints to work when deployed Identity Server

I am building a React app and using Azure Web Apps for hosting. During development time I set my endpoints to localhost throughout my code, but this will not work when deployed as there is no concept of localhost when on Azure. How can I go about managing my endpoints between local and deployed environments? Do I have to do conditional checks during Startup and set a variable that I then reference, or is there an easier way to manage this?

Aside from using relative paths (vs absolute paths prefixed with localhost ), Azure Web Apps offers application settings which are settable outside of your app, and then read in through the environment (via your app).

Take a look under your Web App's application settings, where you can create various settings for your app. For example:

在此处输入图片说明

For local dev, you can have your own local environment settings eg app_uri = localhost , and for the deployed app, set to something like https://some-address.com , configured via Application Settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM