GenAIExamples icon indicating copy to clipboard operation
GenAIExamples copied to clipboard

chatqna ui - nginx proxy_pass

Open SeanCondon opened this issue 1 year ago • 7 comments

Description

This adds a proxy_pass inside the nginx.conf of the chatqna-conversation-ui. This has the effect of avoiding CORS errors when the Javascript in the browser calls the backend service. CORS error occur when the javascript makes a call to a backend host:port not equal to where it was loaded from.

The effect is that the javascript now calls http://host:port/v1/chatqna which the nginx service in the pod will remap to http://chatqna:8888/v1/chatqna inside the cluster.

This was undertaken on the suggestion of @Ruoyu-y in this PR 305 on GenAIInfra

This is an additional fix for #493 and #528

Issues

n/a

Type of change

List the type of change like below. Please delete options that are not relevant.

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds new functionality)
  • [ ] Breaking change (fix or feature that would break existing design and interface)
  • [ ] Others (enhancement, documentation, validation, etc.)

Dependencies

List the newly introduced 3rd party dependency if exists.

Tests

Load the services with docker compose according to the instructions in README.md in docker/xeon

SeanCondon avatar Aug 17 '24 17:08 SeanCondon

@SeanCondon with this approach for every api that would be integrated in the UI we have to update nginx.conf file. will this don't be a overhead when it comes to productivity suite in which all the examples would be part of single UI.

jaswanth8888 avatar Aug 19 '24 09:08 jaswanth8888

@SeanCondon with this approach for every api that would be integrated in the UI we have to update nginx.conf file. will this don't be a overhead when it comes to productivity suite in which all the examples would be part of single UI.

Do you have a pointer to the productivity suite? I think this proxy_pass for the nginx.conf will be necessary in all situations, as it is the best way for avoiding CORS restrictions securely. The only other alternative is to have a separate load balancer container in front of the UI that will handle these redirects, but that would require the same amount of maintenance.

SeanCondon avatar Aug 19 '24 09:08 SeanCondon

@SeanCondon with this approach for every api that would be integrated in the UI we have to update nginx.conf file. will this don't be a overhead when it comes to productivity suite in which all the examples would be part of single UI.

Do you have a pointer to the productivity suite? I think this proxy_pass for the nginx.conf will be necessary in all situations, as it is the best way for avoiding CORS restrictions securely. The only other alternative is to have a separate load balancer container in front of the UI that will handle these redirects, but that would require the same amount of maintenance.

@SeanCondon https://github.com/opea-project/GenAIExamples/pull/592 please have look at this PR

jaswanth8888 avatar Aug 20 '24 06:08 jaswanth8888

@SeanCondon, Maybe you can have a check about the recent changes in 'svelte' UI. We have added some endpoints for other file operations.

CHAT_BASE_URL = 'http://backend_address:8888/v1/chatqna'

UPLOAD_FILE_BASE_URL = 'http://backend_address:6007/v1/dataprep'

GET_FILE = 'http://backend_address:6007/v1/dataprep/get_file'

DELETE_FILE = 'http://backend_address:6007/v1/dataprep/delete_file'

lvliang-intel avatar Aug 31 '24 14:08 lvliang-intel

@SeanCondon, Maybe you can have a check about the recent changes in 'svelte' UI. We have added some endpoints for other file operations.

CHAT_BASE_URL = 'http://backend_address:8888/v1/chatqna'

UPLOAD_FILE_BASE_URL = 'http://backend_address:6007/v1/dataprep'

GET_FILE = 'http://backend_address:6007/v1/dataprep/get_file'

DELETE_FILE = 'http://backend_address:6007/v1/dataprep/delete_file'

I have looked at this UI and I think it needs the same treatment of having a proxy.

To be honest I have tried to submit this PR and did not get any kind of positive feedback.

I do not have time to keep chasing the CI while I wait for some constructive feedback.

CC @jaswanth8888

SeanCondon avatar Sep 02 '24 18:09 SeanCondon

@SeanCondon, Maybe you can have a check about the recent changes in 'svelte' UI. We have added some endpoints for other file operations.

CHAT_BASE_URL = 'http://backend_address:8888/v1/chatqna'

UPLOAD_FILE_BASE_URL = 'http://backend_address:6007/v1/dataprep'

GET_FILE = 'http://backend_address:6007/v1/dataprep/get_file'

DELETE_FILE = 'http://backend_address:6007/v1/dataprep/delete_file'

@lvliang-intel please see my latest changes to tackle the Svelte UI

SeanCondon avatar Sep 09 '24 09:09 SeanCondon

If this is target v1.0, we need to merge by today.

chensuyue avatar Sep 11 '24 14:09 chensuyue

Do we still need this PR? @SeanCondon

chensuyue avatar Nov 14 '24 03:11 chensuyue