gpt4 book ai didi

api - Jhipster ssl api 身份验证 Ionic PWA 部署到 firebase

转载 作者:太空宇宙 更新时间:2023-11-03 13:30:39 25 4
gpt4 key购买 nike

我这里有一个安全的 Jhispter 应用程序 https://api.nms.blaucomm.co.uk:8050/#/我可以登录

server:
# port: 8060
port: 8050
ssl:
key-store: classpath:nms-PKCS-12.p12
key-store-password: MYPASS
key-store-type: PKCS12
key-alias: nmsapi

当我尝试登录我部署到 firebase 的 Ionic PWA 时 https://gotopnms.firebaseapp.com

它说:

[Error] XMLHttpRequest cannot load https://api.nms.blaucomm.co.uk:8050/#//authenticate due to access control checks.


error: XMLHttpRequestProgressEvent
bubbles: false
cancelBubble: false
cancelable: false
composed: false
currentTarget: null
defaultPrevented: false
eventPhase: 0
isTrusted: true
lengthComputable: false
loaded: 0
position: 0
returnValue: true
srcElement: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "https://api.nms.blaucomm.co.uk:8050/#//authenticate", __zone_symbol__loadfalse: Array, __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …}

target: XMLHttpRequest {__zone_symbol__xhrSync: false, __zone_symbol__xhrURL: "https://api.nms.blaucomm.co.uk:8050/#//authenticate", __zone_symbol__loadfalse: Array, __zone_symbol__errorfalse: null, __zone_symbol__xhrScheduled: true, …}

timeStamp: 69734
total: 0
totalSize: 0
type: "error"
XMLHttpRequestProgressEvent Prototype
headers: HttpHeaders {normalizedNames: Map, lazyUpdate: null, headers: Map, has: function, get: function, …}

message: "Http failure response for https://api.nms.blaucomm.co.uk:8050/#//authenticate: 0 Unknown Error"

name: "HttpErrorResponse"
ok: false
status: 0
statusText: "Unknown Error"
url: "https://api.nms.blaucomm.co.uk:8050/#//authenticate"

[Log] Login error – HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", …} (main.js, line 2050)

HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: "Unknown Error", url: "https://api.nms.blaucomm.co.uk:8050/#//authenticate", ok: false, …}HttpErrorResponse

但我有这样的cors conf:

cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-headers: "*"
exposed-headers: "Authorization,Link,X-Total-Count"
allow-credentials: true
max-age: 1800

如果我使用不安全的 urlAPI:' http://35.230.141.174:8060/api ',在我的本地主机中,我可以登录我的 Ionic PWA https://youtu.be/yIZ6jY2aAXs没有cors问题

我的 ionic 环境

export const environment = {
production: true,
// urlAPI: 'http://35.230.141.174:8060/api',
urlAPI: 'https://api.nms.blaucomm.co.uk:8050/#',
socketConf: {
url: 'http://35.230.141.174:3050',
options: { reconnection: true, reconnectionDelay: 3000, timeout: 60000 }
},

注意:我还没有固定套接字。所以他们也给出了错误。

我需要用 nginx 做什么?(我没有使用 nginx,但我知道 Debian 服务器有它)

我在某处看到它可以用 get 替换 rest api 帖子,但我不知道在哪里...

也许我缺少一些 Jhispter 配置?

最佳答案

解决了。也许可以帮助某人。我必须关闭 VSCode 才能进行 ionic 构建工作,并且我在环境中有

urlAPI: 'https://api.nms.blaucomm.co.uk:8050/#',

代替

urlAPI: 'https://api.nms.blaucomm.co.uk:8050/api',

关于api - Jhipster ssl api 身份验证 Ionic PWA 部署到 firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56626696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com