Closed fawqsir closed 1 year ago
Very much appreciate this! Thank so much
version: '3' services: shlink-app: container_name: ${CONTAINER_NAME:-shlink}-app image: ghcr.io/shlinkio/shlink:stable environment: DEFAULT_DOMAIN: ${DOMAIN_NAME} BASE_PATH: /url PORT: ${PORT:-8080} TIMEZONE: America/Regina GEOLITE_LICENSE_KEY: ${GEOLITE_LICENSE_KEY} DB_DRIVER: postgres DB_USER: ${POSTGRES_USER:-shlink} DB_NAME: ${POSTGRES_DB:-shlink} DB_PASSWORD: ${POSTGRES_PASSWORD:-shlink} DB_HOST: ${POSTGRES_HOST:-shlink-db} DB_PORT: ${POSTGRES_PORT:-5432} INITIAL_API_KEY: ${INITIAL_API_KEY} restart: unless-stopped depends_on: - shlink-db labels: - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.services.${CONTAINER_NAME:-shlink}.loadbalancer.server.port=${PORT:-8080}" - "traefik.http.routers.${CONTAINER_NAME:-shlink}.entrypoints=web" - "traefik.http.routers.${CONTAINER_NAME:-shlink}.rule=Host(`${DOMAIN_NAME}`) && PathPrefix(`/url`)" # use to redirect http to https - "traefik.http.routers.${CONTAINER_NAME:-shlink}.middlewares=https-redirect" - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-secure.entrypoints=websecure" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-secure.rule=Host(`${DOMAIN_NAME}`) && PathPrefix(`/url`)" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-secure.tls.certresolver=tlsresolver" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-secure.tls=true" - "traefik.http.middlewares.https-sslheaders.headers.accessControlAllowCredentials=true" - "traefik.http.middlewares.https-sslheaders.headers.forceSTSHeader=true" - "traefik.http.middlewares.https-sslheaders.headers.browserxssfilter=true" - "traefik.http.middlewares.https-sslheaders.headers.stsIncludeSubdomains=true" - "traefik.http.middlewares.https-sslheaders.headers.stsPreload=true" # Enable CORS headers #- "traefik.http.middlewares.cors.headers.accessControlAllowCredentials=true" #- "traefik.http.middlewares.cors.headers.accessControlExposeHeaders=*" - "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=GET,PUT,DELETE,PATCH" #- "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=*" - "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=*" - "traefik.http.middlewares.cors.headers.accesscontrolmaxage=100" - "traefik.http.middlewares.cors.headers.addvaryheader=true" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-secure.middlewares=https-sslheaders,cors" networks: - traefik_proxy - internal shlink-web: container_name: ${CONTAINER_NAME:-shlink}-web image: ghcr.io/shlinkio/shlink-web-client labels: - "traefik.enable=true" - "traefik.docker.network=traefik_proxy" - "traefik.http.services.${CONTAINER_NAME:-shlink}-web.loadbalancer.server.port=80" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web.entrypoints=web" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web.rule=Host(`${DOMAIN_NAME}`) && PathPrefix(`/${CONTAINER_NAME:-shlink}`)" # use to redirect http to https - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web.middlewares=https-redirect" - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web-secure.entrypoints=websecure" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web-secure.rule=Host(`${DOMAIN_NAME}`) && PathPrefix(`/${CONTAINER_NAME:-shlink}`)" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web-secure.tls.certresolver=tlsresolver" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web-secure.tls=true" - "traefik.http.routers.${CONTAINER_NAME:-shlink}-web-secure.middlewares=https-sslheaders,strip-prefix" networks: - traefik_proxy depends_on: - shlink-app restart: unless-stopped profiles: - web shlink-db: image: postgres:15-alpine container_name: ${CONTAINER_NAME:-shlink}-db restart: unless-stopped volumes: - ./data/postgres:/var/lib/postgresql/data environment: POSTGRES_USER: ${POSTGRES_USER:-shlink} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-shlink} POSTGRES_DB: ${POSTGRES_DB:-shlink} networks: - internal networks: traefik_proxy: external: true internal: driver: bridge internal: true attachable: false
When I go to https://example.com/url/whoami the browser returns "An unexpected error occurred" and the log returns
[2023-05-08T14:13:06.716891-06:00] [22e85b08-96ed-491e-9551-48bf0a5996e2] Access.ERROR - - "GET /url/whoami HTTP/1.1" 500 28
after refreshing the page of the brower it forwards to the correct page. ie: https://example.com/whoam/
and the log shows:
[2023-05-08T14:14:59.404806-06:00] [41bc9c74-6e37-4352-a110-25db9d270729] Access.INFO - - "GET /url/whoami HTTP/1.1" 302 0
When I use curl the same thing happens the first time and then subsequent times all is good.
curl -X 'GET' \ 'https://example.com/url/rest/v3/short-urls/whoami' \ -H 'accept: application/json' \ -H 'X-Api-Key: REDACTED'
Returns: {"title":"Internal Server Error","type":"https://shlink.io/api/error/internal-server-error","status":500,"detail":"An unknown error occurred."}
enter same again:
returns:
{"shortCode":"whoami","shortUrl":"https://example.com/url/whoami","longUrl":"https://example.com/whoami/","deviceLongUrls":{"android":null,"ios":null,"desktop":null},"dateCreated":"2023-05-08T14:09:54-06:00","tags":[],"meta":{"validSince":null,"validUntil":null,"maxVisits":null},"domain":null,"title":null,"crawlable":false,"forwardQuery":true,"visitsSummary":{"total":11,"nonBots":11,"bots":0},"visitsCount":11}
Suspecting that because of this error I am not able to connect to https://example.com/url on https://app.shlink.io
should go directly the appropriator link without refreshing page. Curl should return information the first time.
Use docker compose and create a link https://example.com/url/whoami that redirects to https;//example.com/whoami/
There should be more information in the logs, like the full stack trace of the error. Can you share that?
Very much appreciate this! Thank so much
How Shlink is set up on docker-compose.yml
Summary
When I go to https://example.com/url/whoami the browser returns "An unexpected error occurred" and the log returns
[2023-05-08T14:13:06.716891-06:00] [22e85b08-96ed-491e-9551-48bf0a5996e2] Access.ERROR - - "GET /url/whoami HTTP/1.1" 500 28
Current behavior
When I go to https://example.com/url/whoami the browser returns "An unexpected error occurred" and the log returns
[2023-05-08T14:13:06.716891-06:00] [22e85b08-96ed-491e-9551-48bf0a5996e2] Access.ERROR - - "GET /url/whoami HTTP/1.1" 500 28
after refreshing the page of the brower it forwards to the correct page. ie: https://example.com/whoam/
and the log shows:
[2023-05-08T14:14:59.404806-06:00] [41bc9c74-6e37-4352-a110-25db9d270729] Access.INFO - - "GET /url/whoami HTTP/1.1" 302 0
When I use curl the same thing happens the first time and then subsequent times all is good.
curl -X 'GET' \ 'https://example.com/url/rest/v3/short-urls/whoami' \ -H 'accept: application/json' \ -H 'X-Api-Key: REDACTED'
Returns: {"title":"Internal Server Error","type":"https://shlink.io/api/error/internal-server-error","status":500,"detail":"An unknown error occurred."}
enter same again:
curl -X 'GET' \ 'https://example.com/url/rest/v3/short-urls/whoami' \ -H 'accept: application/json' \ -H 'X-Api-Key: REDACTED'
returns:
{"shortCode":"whoami","shortUrl":"https://example.com/url/whoami","longUrl":"https://example.com/whoami/","deviceLongUrls":{"android":null,"ios":null,"desktop":null},"dateCreated":"2023-05-08T14:09:54-06:00","tags":[],"meta":{"validSince":null,"validUntil":null,"maxVisits":null},"domain":null,"title":null,"crawlable":false,"forwardQuery":true,"visitsSummary":{"total":11,"nonBots":11,"bots":0},"visitsCount":11}
Suspecting that because of this error I am not able to connect to https://example.com/url on https://app.shlink.io
Expected behavior
should go directly the appropriator link without refreshing page. Curl should return information the first time.
How to reproduce
Use docker compose and create a link https://example.com/url/whoami that redirects to https;//example.com/whoami/