Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option for different api routes not using /api prefix #42

Closed
heisig opened this issue May 3, 2023 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@heisig
Copy link

heisig commented May 3, 2023

Clear and concise description of the problem

It would be great to use other routes than /api/_sitemap-urls for handling dynamic URLs.
In our project, the routes with prefix /api are used differently and collide with the hardcoded server/api/_sitemap-urls.ts.

Suggested solution

If possible, a configuration could be implemented to choose the prefered route.
Here the nuxt documentation describes how to use server routes without the /api prefix

Maybe this route has to be configurable too: /api/__sitemap__/document-driven-urls

I would love to hear your thoughts on this topic.

Alternative

No response

Additional context

No response

@heisig heisig added the enhancement New feature or request label May 3, 2023
@harlan-zw
Copy link
Collaborator

harlan-zw commented May 5, 2023

Hey @heisig, thanks for the suggestion!

Would you mind reviewing the PR to support it: #44

I'm hesitant to add supporting for modifying the /api/__sitemap__/document-driven-urls endpoint as it's one registered by the module. Is your site actually using it? If so, can you elaborate on the issues you have with this? Is it because you're applying some middleware to all api routes?

@heisig
Copy link
Author

heisig commented May 8, 2023

Thanks for the quick answer! I will have a look at the PR though I might not be the perfect person for a review.

Regarding the /api/__sitemap__/document-driven-urls endpoint: I am not sure what the purpose of this endpoint is. I just found it in the source code and thought it would be something to modify aswell when a dynamic endpoint is choosable.

For our site there is a reverse proxy which routes the client requests to the right destination. https://*frontend*/ to the nuxt server and among others https://*frontend*/api to a custom backend. Now every request going to /api will never get to the nuxt server. Custom endpoints for the sitemap would help our implementation in this regard.

@heisig heisig closed this as completed May 8, 2023
@heisig heisig reopened this May 8, 2023
@harlan-zw
Copy link
Collaborator

Thanks for the details :)

The PR is merged and available in 2.5.0. Give it a try and if you're still having issues happy to investigate further configuration requirements

export default defineNuxtConfig({
  sitemap: {
    dynamicUrlsApiEndpoint: '/__sitemap',
  },
})

@heisig
Copy link
Author

heisig commented May 16, 2023

Thanks a ton! All is working well and we can finally use the sitemap correctly :)

@heisig heisig closed this as completed May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants