I'm working in a project where the stack is Laravel API, NextJs, docker and Nginx for reverse proxy and all is redirected to HTTPS.
The communications between frontend and laravel api is working, but I'm having a problem with SSR in NextJs (with axios) when I want to get data from Laravel API .
Issue:
errors: [
Error: connect ECONNREFUSED ::1:443
at createConnectionError (node:net:1647:14)
at afterConnectMultiple (node:net:1677:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 443
},
Error: connect ECONNREFUSED 127.0.0.1:443
at createConnectionError (node:net:1647:14)
at afterConnectMultiple (node:net:1677:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 443
}
],
Headers and extra data that axios sends
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http', 'fetch' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json',
'Content-Type': 'application/json',
Cookie: 'X-XSRF-TOKEN=eyJpdiI6IlZsQUdVUXoyYjVLUmc2T1B1TE1ZS3c9PSIsInZhbHVlIjoiWGJlUDZmMS9PVzdBWThRRUpPbTdqRWdmbnFxbEVzVjRmSXBBRlpSY3dodytSaEhlMWNpYTFNMHhmQkpLZHZCell4c3ZGVkl4WWZKNWNjeU8vRkk1VGhsMVZIcWpVenUrWGhIMUlOb0ZXeC9HM1p3VlZLaUVjcCs0RkorNml5c00iLCJtYWMiOiIzZWU1ZDI2ZTcyOGNmYmQwNDdlY2ZjZGM3NjU3ODYwY2MyYTE1Nzc1MGYxZDVkNGQ4NGQ1YjczMDI1MDBhZDFkIiwidGFnIjoiIn0=; final_draw_session=eyJpdiI6IllESEtrcEdHVjg1OXZ1c01XcG8vNGc9PSIsInZhbHVlIjoiZnNrVEMrRUZ1MjJmK0o4T3BFWWdsNUg2bUVOTHN3R1lvNGowQVFLVkhIRnJpS1A2OUd6c3pQUG1vVTlnSVFoRDlyYStaa1BjUm1XWW0wNGhURFRRMzJLTVFJNCt5T0Zjcjlab2wwZWFseC9vU2MyTmxrMkVEOHdRTGM5cUtZN1QiLCJtYWMiOiI0YTRlY2I2ZDFiOWJiYTIwOTU5ODdhMzUxMmQzNjAxZWVmY2M3ZWEwYTI4OTYxMWRmYWNhNTllNjg4ODBlYThmIiwidGFnIjoiIn0=;',
Origin: 'https://localhost',
'App-Language': 'es',
'User-Agent': 'axios/1.7.4',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
baseURL: 'https://localhost/api',
withCredentials: true,
method: 'get',
url: '/categories',
data: undefined
},
Nginx config:
upstream backend {
server findra-php:9000;
}
upstream frontend {
server findra-node:3000;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name localhost;
# SSL certificate
ssl_certificate /etc/nginx/ssl/public.crt;
ssl_certificate_key /etc/nginx/ssl/private.key;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
if (!-d $request_filename){
rewrite ^/(.+)/$ /$1 permanent;
}
## Handle Horizon requests
location /findra-queues/horizon {
root /var/www/finaldraw/nadal/public;
try_files $uri $uri/ /index.php?$query_string;
# PHP-FPM configuration
include fastcgi_params;
fastcgi_pass backend;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_hide_header X-Powered-By;
}
## Handle API requests and pass them to index.php if the file doesn't exist
location /api/ {
root /var/www/finaldraw/nadal/public;
add_header Access-Control-Allow-Origin localhost;
try_files $uri $uri/ /index.php?$query_string;
}
## Handle PHP requests
location ~ [^/]\.php(/|$) {
root /var/www/finaldraw/nadal/public;
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
include fastcgi_params;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_hide_header X-Powered-By;
}
## Handle all other requests with the frontend (Node.js)
location / {
proxy_pass http://frontend/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# deny access to .htaccess files, if Apache's document root concurs with nginx's one
location ~ /\.ht {
deny all;
}
}
Docker compose
services:
# ##############################
# ###### SETUP AND BASE SERVICES
# ##############################
## Node builder
findra-node-builder:
build:
context: ./config/docker/node
container_name: findra-node-builder
restart: no
user: node
volumes:
- type: bind
source: ./federer
target: ${FRONTEND_CONTAINER_PATH}
working_dir: ${FRONTEND_CONTAINER_PATH}
profiles:
- builder
## Laravel builder
findra-laravel-builder:
build:
context: ./config/docker/php
args:
USER_ID: ${USER_ID:-0}
GROUP_ID: ${GROUP_ID:-0}
user: www-data:www-data
container_name: findra-laravel-builder
restart: no
volumes:
- type: bind
source: ./nadal
target: ${BACKEND_CONTAINER_PATH}
working_dir: ${BACKEND_CONTAINER_PATH}
environment:
APP_DIRECTORY: ${BACKEND_CONTAINER_PATH}
depends_on:
findra-mysql:
condition: service_healthy
findra-redis:
condition: service_healthy
findra-minio:
condition: service_healthy
networks:
- backend
profiles:
- builder
# ########################
# ###### FRONTEND SERVICES
# ########################
## Node container for regular execution of the Federer project
findra-node:
build:
context: ./config/docker/node
container_name: findra-node
restart: unless-stopped
volumes:
- type: bind
source: ./federer
target: ${FRONTEND_CONTAINER_PATH}
working_dir: ${FRONTEND_CONTAINER_PATH}
command: ["npm", "run", "dev"]
healthcheck:
test: ["CMD", "curl", "-f", "localhost:3000"]
interval: 15s
timeout: 5s
retries: 150
networks:
- frontend
# #######################
# ###### BACKEND SERVICES
# #######################
## Nginx container
findra-nginx:
container_name: findra-nginx
build:
context: ./config/docker/nginx
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
findra-php:
condition: service_healthy
findra-node:
condition: service_healthy
ports:
- protocol: tcp
published: ${NGINX_PORT}
target: 80
- protocol: tcp
published: ${NGINX_SSL_PORT}
target: 443
volumes:
- type: bind
source: ./config/certs
target: /etc/nginx/ssl
healthcheck:
test: ["CMD", "curl", "-k", "-f", "https://localhost:443"]
interval: 15s
timeout: 5s
retries: 150
networks:
- frontend
- backend
## PHP container for regular execution (contains and runs the Laravel base
findra-php:
container_name: findra-php
build:
context: ./config/docker/php
args:
USER_ID: ${USER_ID:-0}
GROUP_ID: ${GROUP_ID:-0}
user: www-data:www-data
depends_on:
findra-mysql:
condition: service_healthy
findra-redis:
condition: service_healthy
restart: unless-stopped
ports:
- "9000:9000"
volumes:
- type: bind
source: ./nadal
target: ${BACKEND_CONTAINER_PATH}
working_dir: ${BACKEND_CONTAINER_PATH}
healthcheck:
test: ["CMD", "php-fpm-healthcheck"]
interval: 15s
timeout: 5s
retries: 150
networks:
- backend
# #########################
# ###### DATABASES SERVICES
# #########################
## MySQL database
findra-mysql:
image: mysql:8
container_name: findra-mysql
restart: unless-stopped
volumes:
- type: volume
source: findra_mysql
target: /var/lib/mysql
ports:
- protocol: tcp
published: ${MYSQL_PORT}
target: 3306
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u root", "-p ${MYSQL_ROOT_PASSWORD}"]
interval: 30s
timeout: 10s
retries: 5
networks:
- backend
## Redis database for caching
findra-redis:
image: redis:7-alpine
container_name: findra-redis
restart: unless-stopped
volumes:
- type: volume
source: findra_redis
target: /data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
networks:
- backend
# ########################
# ###### MAIL SERVICE
# ########################
## Mailhog service
findra-mailhog:
image: mailhog/mailhog
container_name: findra-mailhog
restart: unless-stopped
platform: linux/amd64
ports:
- protocol: tcp
published: ${MAILHOG_PORT}
target: 8025
depends_on:
findra-nginx:
condition: service_healthy
networks:
- backend
########################
###### STORAGE SERVICE
########################
## Minio storage service
findra-minio:
container_name: findra-minio
image: minio/minio
command: server --certs-dir /root/.minio/certs --console-address ":${FORWARD_MINIO_CONSOLE_PORT:-9002}" --address ":${FORWARD_MINIO_PORT:-9001}" /data
ports:
- '${FORWARD_MINIO_PORT:-9001}:9001'
- '${FORWARD_MINIO_API_PORT:-9002}:9002'
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
MINIO_SERVER_URL: "https://localhost:9001"
healthcheck:
test: timeout 5s bash -c ':> /dev/tcp/localhost/9001' || exit 1
interval: 30s
timeout: 10s
retries: 5
volumes:
- type: volume
source: findra_minio
target: /data
- type: bind
source: ./config/certs
target: /root/.minio/certs
networks:
- backend
##########################
####### WORKERS SERVICE
##########################
## Horizon worker
findra-horizon:
container_name: findra-horizon
build:
context: ./config/docker/php
command: ["php", "${BACKEND_CONTAINER_PATH}/artisan", "horizon"]
volumes:
- type: bind
source: ./nadal
target: ${BACKEND_CONTAINER_PATH}
depends_on:
findra-php:
condition: service_healthy
working_dir: ${BACKEND_CONTAINER_PATH}
restart: unless-stopped
networks:
- backend
networks:
backend:
driver: bridge
frontend:
driver: bridge
volumes:
findra_mysql: {}
findra_redis: {}
findra_minio: {}
Axios config - NextJs
import axios from 'axios'
import { getCookie } from '@/utils/cookies/cookies'
import { DEFAULT_LOCALE } from '@/langs/locales'
import { APP_LANGUAGE } from '@/utils/cookies/constants'
function isServer () {
return typeof window === 'undefined'
}
const httpAPIClient = createHttpClient('https://localhost/api')
httpAPIClient.interceptors.request.use(setAppLanguageHeader)
function createHttpClient (baseURL) {
return axios.create({
baseURL,
withCredentials: true,
headers: {
'Content-type': 'application/json',
'Accept': 'application/json'
}
})
}
function setAppLanguageHeader (config) {
if (config && config.headers) {
if (!isServer()) {
config.headers[APP_LANGUAGE] = getCookie('NEXT_LOCALE') ?? DEFAULT_LOCALE
}
}
return config
}
export { httpAPIClient }
Server file where I add the X-XSRF-TOKEN and cookie session.
import { httpAPIClient } from '@/config/httpClient'
import { cookies } from 'next/headers'
import { APP_LANGUAGE, FINAL_DRAW_SESSION, NEXT_LOCALE, XSRF_TOKEN } from '@/utils/cookies/constants'
function setAuthServerCookies () {
const lang = cookies().get(NEXT_LOCALE)
const xsrfCookie = cookies().get(XSRF_TOKEN)
const fdsCookie = cookies().get(FINAL_DRAW_SESSION)
if (xsrfCookie && fdsCookie) {
httpAPIClient.defaults.headers.Cookie = `X-XSRF-TOKEN=${xsrfCookie?.value}; ${fdsCookie?.name}=${fdsCookie?.value};`
httpAPIClient.defaults.headers.Origin = `${process.env.ORIGIN}`
httpAPIClient.defaults.headers.Origin = `${process.env.ORIGIN}`
}
httpAPIClient.defaults.headers[APP_LANGUAGE] = `${lang.value}`
}
export { setAuthServerCookies }
Finally my page in Next:
import CategoryService from '@/services/CategoryService'
import { CategoryView } from '@/views/admin/category'
import { setAuthServerCookies } from '@/utils/server'
async function getCategories () {
setAuthServerCookies()
try {
const response = await CategoryService.getAll()
return response.data.categories
} catch (err) {
console.log('Category page: ', err)
}
}
export default async function CateogoriesPage () {
const categories = await getCategories()
return (
<CategoryView categories={categories} />
)
}
Full Error:
2024-09-13 23:40:18 Category page: AxiosError [AggregateError]
2024-09-13 23:40:18 at AxiosError.from (webpack-internal:///(rsc)/./node_modules/axios/lib/core/AxiosError.js:94:14)
2024-09-13 23:40:18 at RedirectableRequest.handleRequestError (webpack-internal:///(rsc)/./node_modules/axios/lib/adapters/http.js:650:75)
2024-09-13 23:40:18 at RedirectableRequest.emit (node:events:520:28)
2024-09-13 23:40:18 at eventHandlers.<computed> (webpack-internal:///(rsc)/./node_modules/follow-redirects/index.js:38:24)
2024-09-13 23:40:18 at ClientRequest.emit (node:events:520:28)
2024-09-13 23:40:18 at emitErrorEvent (node:_http_client:103:11)
2024-09-13 23:40:18 at TLSSocket.socketErrorListener (node:_http_client:506:5)
2024-09-13 23:40:18 at TLSSocket.emit (node:events:520:28)
2024-09-13 23:40:18 at emitErrorNT (node:internal/streams/destroy:170:8)
2024-09-13 23:40:18 at emitErrorCloseNT (node:internal/streams/destroy:129:3)
2024-09-13 23:40:18 at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
2024-09-13 23:40:18 at Axios.request (webpack-internal:///(rsc)/./node_modules/axios/lib/core/Axios.js:57:41)
2024-09-13 23:40:18 at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2024-09-13 23:40:18 at async CategoryService.getAll (webpack-internal:///(rsc)/./src/services/CategoryService.ts:9:16)
2024-09-13 23:40:18 at async getCategories (webpack-internal:///(rsc)/./src/app/[locale]/admin/categories/page.tsx:17:26)
2024-09-13 23:40:18 at async CateogoriesPage (webpack-internal:///(rsc)/./src/app/[locale]/admin/categories/page.tsx:24:24) {
2024-09-13 23:40:18 code: 'ECONNREFUSED',
2024-09-13 23:40:18 errors: [
2024-09-13 23:40:18 Error: connect ECONNREFUSED ::1:443
2024-09-13 23:40:18 at createConnectionError (node:net:1647:14)
2024-09-13 23:40:18 at afterConnectMultiple (node:net:1677:16)
2024-09-13 23:40:18 at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2024-09-13 23:40:18 errno: -111,
2024-09-13 23:40:18 code: 'ECONNREFUSED',
2024-09-13 23:40:18 syscall: 'connect',
2024-09-13 23:40:18 address: '::1',
2024-09-13 23:40:18 port: 443
2024-09-13 23:40:18 },
2024-09-13 23:40:18 Error: connect ECONNREFUSED 127.0.0.1:443
2024-09-13 23:40:18 at createConnectionError (node:net:1647:14)
2024-09-13 23:40:18 at afterConnectMultiple (node:net:1677:16)
2024-09-13 23:40:18 at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2024-09-13 23:40:18 errno: -111,
2024-09-13 23:40:18 code: 'ECONNREFUSED',
2024-09-13 23:40:18 syscall: 'connect',
2024-09-13 23:40:18 address: '127.0.0.1',
2024-09-13 23:40:18 port: 443
2024-09-13 23:40:18 }
2024-09-13 23:40:18 ],
2024-09-13 23:40:18 config: {
2024-09-13 23:40:18 transitional: {
2024-09-13 23:40:18 silentJSONParsing: true,
2024-09-13 23:40:18 forcedJSONParsing: true,
2024-09-13 23:40:18 clarifyTimeoutError: false
2024-09-13 23:40:18 },
2024-09-13 23:40:18 adapter: [ 'xhr', 'http', 'fetch' ],
2024-09-13 23:40:18 transformRequest: [ [Function: transformRequest] ],
2024-09-13 23:40:18 transformResponse: [ [Function: transformResponse] ],
2024-09-13 23:40:18 timeout: 0,
2024-09-13 23:40:18 xsrfCookieName: 'XSRF-TOKEN',
2024-09-13 23:40:18 xsrfHeaderName: 'X-XSRF-TOKEN',
2024-09-13 23:40:18 maxContentLength: -1,
2024-09-13 23:40:18 maxBodyLength: -1,
2024-09-13 23:40:18 env: { FormData: [Function], Blob: [class Blob] },
2024-09-13 23:40:18 validateStatus: [Function: validateStatus],
2024-09-13 23:40:18 headers: Object [AxiosHeaders] {
2024-09-13 23:40:18 Accept: 'application/json',
2024-09-13 23:40:18 'Content-Type': 'application/json',
2024-09-13 23:40:18 Cookie: 'X-XSRF-TOKEN=eyJpdiI6IlZsQUdVUXoyYjVLUmc2T1B1TE1ZS3c9PSIsInZhbHVlIjoiWGJlUDZmMS9PVzdBWThRRUpPbTdqRWdmbnFxbEVzVjRmSXBBRlpSY3dodytSaEhlMWNpYTFNMHhmQkpLZHZCell4c3ZGVkl4WWZKNWNjeU8vRkk1VGhsMVZIcWpVenUrWGhIMUlOb0ZXeC9HM1p3VlZLaUVjcCs0RkorNml5c00iLCJtYWMiOiIzZWU1ZDI2ZTcyOGNmYmQwNDdlY2ZjZGM3NjU3ODYwY2MyYTE1Nzc1MGYxZDVkNGQ4NGQ1YjczMDI1MDBhZDFkIiwidGFnIjoiIn0=; final_draw_session=eyJpdiI6IllESEtrcEdHVjg1OXZ1c01XcG8vNGc9PSIsInZhbHVlIjoiZnNrVEMrRUZ1MjJmK0o4T3BFWWdsNUg2bUVOTHN3R1lvNGowQVFLVkhIRnJpS1A2OUd6c3pQUG1vVTlnSVFoRDlyYStaa1BjUm1XWW0wNGhURFRRMzJLTVFJNCt5T0Zjcjlab2wwZWFseC9vU2MyTmxrMkVEOHdRTGM5cUtZN1QiLCJtYWMiOiI0YTRlY2I2ZDFiOWJiYTIwOTU5ODdhMzUxMmQzNjAxZWVmY2M3ZWEwYTI4OTYxMWRmYWNhNTllNjg4ODBlYThmIiwidGFnIjoiIn0=;',
2024-09-13 23:40:18 Origin: 'https://localhost',
2024-09-13 23:40:18 'App-Language': 'es',
2024-09-13 23:40:18 'User-Agent': 'axios/1.7.4',
2024-09-13 23:40:18 'Accept-Encoding': 'gzip, compress, deflate, br'
2024-09-13 23:40:18 },
2024-09-13 23:40:18 baseURL: 'https://localhost/api',
2024-09-13 23:40:18 withCredentials: true,
2024-09-13 23:40:18 method: 'get',
2024-09-13 23:40:18 url: '/categories',
2024-09-13 23:40:18 data: undefined
2024-09-13 23:40:18 },
2024-09-13 23:40:18 request: <ref *1> Writable {
2024-09-13 23:40:18 _events: {
2024-09-13 23:40:18 close: undefined,
2024-09-13 23:40:18 error: [Function: handleRequestError],
2024-09-13 23:40:18 prefinish: undefined,
2024-09-13 23:40:18 finish: undefined,
2024-09-13 23:40:18 drain: undefined,
2024-09-13 23:40:18 response: [Function: handleResponse],
2024-09-13 23:40:18 socket: [Function: handleRequestSocket]
2024-09-13 23:40:18 },
2024-09-13 23:40:18 _writableState: WritableState {
2024-09-13 23:40:18 highWaterMark: 65536,
2024-09-13 23:40:18 length: 0,
2024-09-13 23:40:18 corked: 0,
2024-09-13 23:40:18 onwrite: [Function: bound onwrite],
2024-09-13 23:40:18 writelen: 0,
2024-09-13 23:40:18 bufferedIndex: 0,
2024-09-13 23:40:18 pendingcb: 0,
2024-09-13 23:40:18 [Symbol(kState)]: 17580812,
2024-09-13 23:40:18 [Symbol(kBufferedValue)]: null
2024-09-13 23:40:18 },
2024-09-13 23:40:18 _maxListeners: undefined,
2024-09-13 23:40:18 _options: {
2024-09-13 23:40:18 maxRedirects: 21,
2024-09-13 23:40:18 maxBodyLength: Infinity,
2024-09-13 23:40:18 protocol: 'https:',
2024-09-13 23:40:18 path: '/api/categories',
2024-09-13 23:40:18 method: 'GET',
2024-09-13 23:40:18 headers: [Object: null prototype],
2024-09-13 23:40:18 agents: [Object],
2024-09-13 23:40:18 auth: undefined,
2024-09-13 23:40:18 family: undefined,
2024-09-13 23:40:18 beforeRedirect: [Function: dispatchBeforeRedirect],
2024-09-13 23:40:18 beforeRedirects: [Object],
2024-09-13 23:40:18 hostname: 'localhost',
2024-09-13 23:40:18 port: '',
2024-09-13 23:40:18 agent: undefined,
2024-09-13 23:40:18 nativeProtocols: [Object],
2024-09-13 23:40:18 pathname: '/api/categories'
2024-09-13 23:40:18 },
2024-09-13 23:40:18 _ended: true,
2024-09-13 23:40:18 _ending: true,
2024-09-13 23:40:18 _redirectCount: 0,
2024-09-13 23:40:18 _redirects: [],
2024-09-13 23:40:18 _requestBodyLength: 0,
2024-09-13 23:40:18 _requestBodyBuffers: [],
2024-09-13 23:40:18 _eventsCount: 3,
2024-09-13 23:40:18 _onNativeResponse: [Function (anonymous)],
2024-09-13 23:40:18 _currentRequest: ClientRequest {
2024-09-13 23:40:18 _events: [Object: null prototype],
2024-09-13 23:40:18 _eventsCount: 7,
2024-09-13 23:40:18 _maxListeners: undefined,
2024-09-13 23:40:18 outputData: [],
2024-09-13 23:40:18 outputSize: 0,
2024-09-13 23:40:18 writable: true,
2024-09-13 23:40:18 destroyed: false,
2024-09-13 23:40:18 _last: true,
2024-09-13 23:40:18 chunkedEncoding: false,
2024-09-13 23:40:18 shouldKeepAlive: true,
2024-09-13 23:40:18 maxRequestsOnConnectionReached: false,
2024-09-13 23:40:18 _defaultKeepAlive: true,
2024-09-13 23:40:18 useChunkedEncodingByDefault: false,
2024-09-13 23:40:18 sendDate: false,
2024-09-13 23:40:18 _removedConnection: false,
2024-09-13 23:40:18 _removedContLen: false,
2024-09-13 23:40:18 _removedTE: false,
2024-09-13 23:40:18 strictContentLength: false,
2024-09-13 23:40:18 _contentLength: 0,
2024-09-13 23:40:18 _hasBody: true,
2024-09-13 23:40:18 _trailer: '',
2024-09-13 23:40:18 finished: true,
2024-09-13 23:40:18 _headerSent: true,
2024-09-13 23:40:18 _closed: false,
2024-09-13 23:40:18 _header: 'GET /api/categories HTTP/1.1\r\n' +
2024-09-13 23:40:18 'Accept: application/json\r\n' +
2024-09-13 23:40:18 'Content-Type: application/json\r\n' +
2024-09-13 23:40:18 'Cookie: X-XSRF-TOKEN=eyJpdiI6IlZsQUdVUXoyYjVLUmc2T1B1TE1ZS3c9PSIsInZhbHVlIjoiWGJlUDZmMS9PVzdBWThRRUpPbTdqRWdmbnFxbEVzVjRmSXBBRlpSY3dodytSaEhlMWNpYTFNMHhmQkpLZHZCell4c3ZGVkl4WWZKNWNjeU8vRkk1VGhsMVZIcWpVenUrWGhIMUlOb0ZXeC9HM1p3VlZLaUVjcCs0RkorNml5c00iLCJtYWMiOiIzZWU1ZDI2ZTcyOGNmYmQwNDdlY2ZjZGM3NjU3ODYwY2MyYTE1Nzc1MGYxZDVkNGQ4NGQ1YjczMDI1MDBhZDFkIiwidGFnIjoiIn0=; final_draw_session=eyJpdiI6IllESEtrcEdHVjg1OXZ1c01XcG8vNGc9PSIsInZhbHVlIjoiZnNrVEMrRUZ1MjJmK0o4T3BFWWdsNUg2bUVOTHN3R1lvNGowQVFLVkhIRnJpS1A2OUd6c3pQUG1vVTlnSVFoRDlyYStaa1BjUm1XWW0wNGhURFRRMzJLTVFJNCt5T0Zjcjlab2wwZWFseC9vU2MyTmxrMkVEOHdRTGM5cUtZN1QiLCJtYWMiOiI0YTRlY2I2ZDFiOWJiYTIwOTU5ODdhMzUxMmQzNjAxZWVmY2M3ZWEwYTI4OTYxMWRmYWNhNTllNjg4ODBlYThmIiwidGFnIjoiIn0=;\r\n' +
2024-09-13 23:40:18 'Origin: https://localhost\r\n' +
2024-09-13 23:40:18 'App-Language: es\r\n' +
2024-09-13 23:40:18 'User-Agent: axios/1.7.4\r\n' +
2024-09-13 23:40:18 'Accept-Encoding: gzip, compress, deflate, br\r\n' +
2024-09-13 23:40:18 'Host: localhost\r\n' +
2024-09-13 23:40:18 'Connection: keep-alive\r\n' +
2024-09-13 23:40:18 '\r\n',
2024-09-13 23:40:18 _keepAliveTimeout: 0,
2024-09-13 23:40:18 _onPendingData: [Function: nop],
2024-09-13 23:40:18 agent: [Agent],
2024-09-13 23:40:18 socketPath: undefined,
2024-09-13 23:40:18 method: 'GET',
2024-09-13 23:40:18 maxHeaderSize: undefined,
2024-09-13 23:40:18 insecureHTTPParser: undefined,
2024-09-13 23:40:18 joinDuplicateHeaders: undefined,
2024-09-13 23:40:18 path: '/api/categories',
2024-09-13 23:40:18 _ended: false,
2024-09-13 23:40:18 res: null,
2024-09-13 23:40:18 aborted: false,
2024-09-13 23:40:18 timeoutCb: [Function: emitRequestTimeout],
2024-09-13 23:40:18 upgradeOrConnect: false,
2024-09-13 23:40:18 parser: null,
2024-09-13 23:40:18 maxHeadersCount: null,
2024-09-13 23:40:18 reusedSocket: false,
2024-09-13 23:40:18 host: 'localhost',
2024-09-13 23:40:18 protocol: 'https:',
2024-09-13 23:40:18 _redirectable: [Circular *1],
2024-09-13 23:40:18 [Symbol(shapeMode)]: false,
2024-09-13 23:40:18 [Symbol(kCapture)]: false,
2024-09-13 23:40:18 [Symbol(kBytesWritten)]: 0,
2024-09-13 23:40:18 [Symbol(kNeedDrain)]: false,
2024-09-13 23:40:18 [Symbol(corked)]: 0,
2024-09-13 23:40:18 [Symbol(kChunkedBuffer)]: [],
2024-09-13 23:40:18 [Symbol(kChunkedLength)]: 0,
2024-09-13 23:40:18 [Symbol(kSocket)]: [TLSSocket],
2024-09-13 23:40:18 [Symbol(kOutHeaders)]: [Object: null prototype],
2024-09-13 23:40:18 [Symbol(errored)]: null,
2024-09-13 23:40:18 [Symbol(kHighWaterMark)]: 65536,
2024-09-13 23:40:18 [Symbol(kRejectNonStandardBodyWrites)]: false,
2024-09-13 23:40:18 [Symbol(kUniqueHeaders)]: null
2024-09-13 23:40:18 },
2024-09-13 23:40:18 _currentUrl: 'https://localhost/api/categories',
2024-09-13 23:40:18 [Symbol(shapeMode)]: true,
2024-09-13 23:40:18 [Symbol(kCapture)]: false
2024-09-13 23:40:18 },
2024-09-13 23:40:18 cause: AggregateError [ECONNREFUSED]:
2024-09-13 23:40:18 at internalConnectMultiple (node:net:1117:18)
2024-09-13 23:40:18 at afterConnectMultiple (node:net:1684:7)
2024-09-13 23:40:18 at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
2024-09-13 23:40:18 code: 'ECONNREFUSED',
2024-09-13 23:40:18 [errors]: [ [Error], [Error] ]
2024-09-13 23:40:18 }
2024-09-13 23:40:18 }
It seems you're trying to connect to localhost, for a container, it'd mean itself, not your host machine.
Try connecting to https://servicename, in your case, https://findra-nginx