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

Utilizing SSR in conjunction with APIM on SWA #175

Open
sb-sh opened this issue May 7, 2024 · 2 comments
Open

Utilizing SSR in conjunction with APIM on SWA #175

sb-sh opened this issue May 7, 2024 · 2 comments

Comments

@sb-sh
Copy link

sb-sh commented May 7, 2024

Hey Geoff--appreciate all the work on SvelteKit and the SWA adapter.

Perhaps I am missing something (still fairly new to SvelteKit), but I have linked Azure API Management to my SWA instance, and in doing so have seemingly removed the ability to SSR any of my pages (as all requests to /api are proxied to APIM). Unsure of how common this is.

Is this something that can be contemplated in the adapter (maybe changing the routing for the page render)? Or, am I better off writing a standalone render function and sticking it behind my APIM instance?

Thanks

@geoffrich
Copy link
Owner

Hey, unfortunately this isn't a use case I'm familiar with. I'm unclear on why proxying the /api route to APIM would make it so the /api/__render request is not handled properly. Do you know what staticwebapp config change would be required?

navigationFallback: {
rewrite: ssrFunctionRoute
},

@sb-sh
Copy link
Author

sb-sh commented Oct 10, 2024

Apologies for the several month delay here.

It may well be a config issue/misunderstanding on my part. I have a project that uses existing APIs that are orchestrated in APIM to render data on the page. So, I just linked my SWA to my APIM instance. Now, with everything sent to /api being proxied to APIM, and no way to exclude certain routes, I either need to define a _render function within my APIM instance (and likely create an Azure Function behind it), or figure out how to change the ssrFunctionRoute in svelte-adapter-azure-swa so that the __render request doesn't proxy to my APIM instance.

It may be just as simple as optionally changing the ssrFunctionRoute /api/_render to /newname/_render to keep things local.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants