Skip to content

Conversation

@gugu
Copy link
Contributor

@gugu gugu commented Dec 5, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 5, 2025 09:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes swagger documentation routing by preventing nginx from incorrectly serving API-related static files from the frontend directory. The key change adds a negative lookahead pattern to exclude /api paths from the static file location block, allowing them to be properly proxied to the backend where swagger docs are served.

  • Added negative lookahead (?!/api) to static file regex pattern to exclude API paths
  • Fixed indentation on the server block opening brace

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try_files $uri /index.html;
}
location ~* /[^/]*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ {
location ~* ^(?!/api)/[^/]*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ {
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern ^(?!/api)/[^/]*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ will only match files directly in the root path (e.g., /style.css, /app.js) but will not match files in subdirectories (e.g., /assets/style.css, /static/app.js).

The pattern /[^/]*\. matches a single slash followed by any characters except slash, then a dot. This means it won't match paths like /static/bundle.js or /assets/logo.png.

If your frontend static files are served from subdirectories, consider using a pattern like:

location ~* ^(?!/api).*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ {

This would match files at any depth while still excluding /api paths.

Suggested change
location ~* ^(?!/api)/[^/]*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ {
location ~* ^(?!/api).*\.(?:ico|css|js|gif|jpe?g|png|woff2)$ {

Copilot uses AI. Check for mistakes.
@gugu gugu merged commit df24823 into main Dec 5, 2025
26 of 35 checks passed
@gugu gugu deleted the swagger-docs-fix branch December 5, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants