swagger-api / swagger-api/swagger-ui

swagger-ui-bundle.js,swagger-ui.css,swagger-ui.js is getting 404 error while accessing index.html .i am using nginx.

Open
#6,270 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: question
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

my swagger dir.
swagger]# ls
favicon-16x16.png index.html swagger-ui-bundle.js swagger-ui.css swagger-ui.js swagger-ui-standalone-preset.js
favicon-32x32.png swagger.json swagger-ui-bundle.js.map swagger-ui.css.map swagger-ui.js.map swagger-ui-standalone-preset.js.map

main nginx.conf file::
server {
listen 80;
listen [::]:80;

server_name st9-restapi-vznl.dynacommercelab.com ;

access_log /var/log/nginx/omnius/ose-restapi_access.log;
error_log /var/log/nginx/omnius/ose-restapi_error.log;

root /opt/omnius/ose;
index index.html index.php;

charset utf-8;
error_page 404 /404.html;

include /etc/nginx/conf.d/gzip.conf;
include /etc/nginx/conf.d/expires.conf;

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

include /etc/nginx/conf.d/ose-restapi.conf;
include /etc/nginx/conf.d/restapi-proxy-restapi.conf;
include /etc/nginx/conf.d/serviceability-proxy-restapi.conf;
include /etc/nginx/conf.d/shoppingcart-proxy-restapi_swagger.conf;
include /etc/nginx/conf.d/validateaddress-proxy-restapi.conf;
include /etc/nginx/conf.d/customersearch-proxy-restapi.conf;
include /etc/nginx/conf.d/coc-proxy-restapi.conf;
include /etc/nginx/conf.d/shoppingcart-proxy-restapi.conf;
include /etc/nginx/conf.d/order-proxy-restapi.conf;
include /etc/nginx/conf.d/multimapper-proxy-restapi.conf;
include /etc/nginx/conf.d/installedbase-proxy-restapi.conf;
}

/shoppingcart-proxy-restapi_swagger.conf
location /api/v1/shoppingcart/api-docs{
proxy_pass http://localhost:9007;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header 'Access-Control-Allow-Origin' 'st9-restapi-vznl.dynacommercelab.com'

shoppingcart.conf
cat shoppingcart.conf
server {
listen 9007;
listen [::]:9007;

server_name shoppingcart ;

access_log /var/log/nginx/omnius/shoppingcart_access.log;
error_log /var/log/nginx/omnius/shoppingcart_error.log;

root /opt/omnius/shoppingcart/public;
index index.html index.php;

charset utf-8;
error_page 404 /404.html;

include /etc/nginx/conf.d/gzip.conf;
include /etc/nginx/conf.d/expires.conf;

location /api/v1/shoppingcart/api-docs {
try_files $uri /swagger/swagger.json$args;
}

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

include /etc/nginx/conf.d/shoppingcart.conf;
}

pathe of swagger files: /opt/omnius/shoppingcart/public/swagger

}

kindly assist me to resolve the issue.

Thanks in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the browser's failed requests for swagger-ui-bundle.js, swagger-ui.css, and swagger-ui.js, then compare those URLs with the /opt/omnius/shoppingcart/public/swagger path. Review the nginx locations in the main configuration, shoppingcart-proxy-restapi_swagger.conf, and shoppingcart.conf, and inspect the nginx error logs. Done means index.html and all referenced Swagger UI assets load without 404 responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nginx
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.