cheshire-cat-ai / admin-vue

Admin panel of the Cheshire Cat AI
GNU General Public License v3.0
32 stars 28 forks source link

[Bug] apiClient still uses http even if the window.location.protocol is "https" #71

Closed ngxson closed 8 months ago

ngxson commented 8 months ago

I suspect this is due to window.location.port is empty if window.location.protocol == 443

See file: https://github.com/cheshire-cat-ai/admin-vue/blob/main/src/api.ts#L12

export const apiClient = new CatClient({
    baseUrl: window.location.hostname,
    port: parseInt((DEV ? '1865' : window.location.port) ?? '80'),
    secure: window.location.protocol === 'https:',
    timeout: 15000,
    ws: {

This is in fact a misuse of window.location.port, see the example below to understand:

image