Fix WebUI CORS Issue

This commit is contained in:
blessedcoolant 2022-10-07 03:23:16 +13:00 committed by Lincoln Stein
parent 7a0d4c3350
commit c7ccb9dacd

View File

@ -53,17 +53,14 @@ class InvokeAIWebServer:
cors_allowed_origins = [
'http://127.0.0.1:5173',
'http://localhost:5173',
'http://localhost:9090'
]
additional_allowed_origins = (
opt.cors if opt.cors else []
) # additional CORS allowed origins
if self.host == '127.0.0.1':
cors_allowed_origins.extend(
[
f'http://{self.host}:{self.port}',
f'http://localhost:{self.port}',
]
)
cors_allowed_origins.append(f'http://{self.host}:{self.port}')
if self.host == '127.0.0.1' or self.host == '0.0.0.0':
cors_allowed_origins.append(f'http://localhost:{self.port}')
cors_allowed_origins = (
cors_allowed_origins + additional_allowed_origins
)