-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebPrefix does not update API_URL #225
Comments
|
Thanks @zhouzhuojie for the quick reply! We are using the following in nginx as a temporary workaround:
Yes, I understand this does not include every possible endpoints, eg. Will take a look at providing a PR when able. |
@zhouzhuojie regarding a PR to allow the API URL to have a prefix. I believe the parameter If we make |
That is a breaking change. For example, people may have API runing at /api/v1 and web UI running at /ui, and then the change of reusing FLAGR_WEB_PREFIX for API will break their client SDK calls. How about not setting
|
@zhouzhuojie That does not actually work because the reverse proxy mechanism will only modify the headers. It does not touch the body which is where API_URL is located (redirecting to a hardcoded /api/v1/*). This is why I have to revert to the above method to make it work in Nginx. ie. 3 different paths. This is regardless of whether we use FLAGR_WEB_PREFIX or not. |
I see. We can make |
Yup, I took a look at that solution too, but it's not elegant due to the need to rebuild. Basically looking for a solution where we do not have to rebuild the docker image. Is it bad to have FLAGR_WEB_PREFIX move API path as well? I understand that it can be a breaking change if someone sets FLAGR_WEB_PREFIX and wants the API to remain at /api/v1. What is the chance that someone needs this? Based on #223 (that was fixed less than 6 days ago), it looks like FLAGR_WEB_PREFIX may not be in use extensively yet. Would you be willing to accept this breaking change and move API based on FLAGR_WEB_PREFIX as well? This would allow us to map the entire app to a different path using a reverse proxy easily. |
Yup, agreed, @SebastianOsuna, since you implemented #170, are you ok with using |
I agree it's a better solution! |
So, I've been taking a look at submitting a PR for this and it looks like it's not all that simple. We generate the API using go-swagger and what's being generated does not allow us to overwrite the
|
@lawrenceong How about #234? |
@zhouzhuojie Looks good to me. Thank you. |
When we add a WebPrefix by defining
FLAGR_WEB_PREFIX
, we are expecting the entire app to use the prefix. We found that the APIs are not using the prefix, resulting in calls to /api/v1 instead of /webprefix/api/v1.Expected Behavior
If we set up flagr locally, calls to the APIs should include the prefix. For example:
The following should return a 200 OK:
curl -v http://localhost:18000/WEBPREFIX/api/v1/health
The following should return a 404 NOT FOUND:
curl -v http://localhost:18000/api/v1/health
Instead, we get the opposite behavior, ie. works without prefix, but does not work with a prefix.
Current Behavior
See Expected Behavior above.
Possible Solution
May be able to fix this by ensuring that API_URL is set based on the provided WebPrefix (ie.
FLAGR_WEB_PREFIX
).Steps to Reproduce (for bugs)
Run up an instance of flagr locally and set
FLAGR_WEB_PREFIX
to /flags. Run the curl commands as per expected behavior.Context
We are trying to run flagr with other applications and this issue prevents it from working as we are proxying only a particular webprefix to flagr.
Your Environment
The text was updated successfully, but these errors were encountered: