Axios/Nuxt "Certificate has expired" 仅当直接打开页面时,而不是对于来自另一个页面的 link

Axios/Nuxt "Certificate has expired" only when directly opening page, but not for a link from another page

我有一个网站,我正在使用 Nuxt.js 和 Axios 帮助维护(但不是我自己建立的)。它目前在主页上显示出奇怪的服务器行为。如果我直接访问主页(比如:https://example.org):

当我在 example.org/about(有效)并点击 link 时也会发生此错误,格式如下:<a href="/" class="navbar-item logo-text">Home</a>

但是,如果我访问主页(都显示 link 为 https://example.org),通过 link on say example.org/about 的形式如下:<a href="/" class="navbar-item nuxt-link-active"><span>Home</span></a>:

所以,奇怪的是,即使对于“/”的两个不同 link,一个会导致错误,而另一个不会(并且它们都在 URL 栏中显示相同的内容).如果我直接在 example.org:5000/tweets 处打开 link 那么它工作正常(脚注:不确定为什么设计选择在那里使用不同的端口,可能相关)。有没有人见过这种行为并且知道为什么会发生这种情况?它在安全模式和所有主要浏览器上持续存在。从过去几天开始工作到停止工作,代码没有任何变化。我收到的具体错误如下所示。

{ Error: certificate has expired
    at TLSSocket.<anonymous> (_tls_wrap.js:1105:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:639:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:469:38)
  code: 'CERT_HAS_EXPIRED',
  config:
   { adapter: [Function: httpAdapter],
     transformRequest: { '0': [Function: transformRequest] },
     transformResponse: { '0': [Function: transformResponse] },
     timeout: 0,
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     headers:
      { Accept: 'application/json, text/plain, */*',
        'User-Agent': 'axios/0.16.2' },
     baseURL: 'https://example.org:5000/',
     method: 'get',
     url: 'https://example.org:5000/tweets',
     data: undefined },
  request:
   Writable {
     _writableState:
      WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: true,
     domain: null,
     _events:
      { response: [Function: handleResponse],
        error: [Function: handleRequestError] },
     _eventsCount: 2,
     _maxListeners: undefined,
     _options:
      { protocol: 'https:',
        maxRedirects: 21,
        maxBodyLength: 10485760,
        hostname: 'example.org',
        port: '5000',
        path: '/tweets',
        method: 'get',
        headers: [Object],
        agent: undefined,
        auth: undefined,
        nativeProtocols: [Object],
        pathname: '/tweets' },
     _redirectCount: 0,
     _redirects: [],
     _requestBodyLength: 0,
     _requestBodyBuffers: [],
     _onNativeResponse: [Function],
     _currentRequest:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 6,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET /tweets HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nUser-Agent: axios/0.16.2\r\nHost: example.org:5000\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/tweets',
        _ended: false,
        res: null,
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        _redirectable: [Circular],
        [Symbol(outHeadersKey)]: [Object] },
     _currentUrl: 'https://example.org:5000/tweets' },
  response: undefined,
  statusCode: 500,
  name: 'NuxtServerError' }

升级到最新版本的 Node 为我解决了这个问题。我遇到的问题与您在 Node v8.10.0 上描述的问题相同。我升级到Node v14.18.1并重启了Nuxt,现在网站正常了

sudo npm cache clean -f
sudo npm install -g n
sudo n stable