Skip to content
New issue

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

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

Already on GitHub? # to your account

Bug - globalHeaders not rendering on hard hitting a path #184

Open
kane81 opened this issue Nov 18, 2024 · 1 comment
Open

Bug - globalHeaders not rendering on hard hitting a path #184

kane81 opened this issue Nov 18, 2024 · 1 comment

Comments

@kane81
Copy link

kane81 commented Nov 18, 2024

Hi,

We are finding the configuration for globalHeaders is not rendering when we hard hit a path. So hitting the / root does not return the configured response headers, however subsequent navigations within the SPA svelte kit application does render the response headers. Hard hitting other than root say /support also fails to render the configured response headers.

svelte.config.js


// SvelteKit configuration with Azure adapter
/** @type {import('@sveltejs/kit').Config} */
const config = {
	preprocess: vitePreprocess(),
	kit: {
		// Use the Azure adapter with custom networking configuration
		adapter: azure({
      customStaticWebAppConfig: {
        // @ts-ignore
        networking: {
          allowedIpRanges // Dynamically set allowed IP ranges from environment variable
        },
        globalHeaders: {"Access-Control-Allow-Origin": "*.mydomain.com.au"}
			}
		})
	}
};

We could remove the configuration from here and set the headers in a hooks.sever.ts file, however prefer to be able to configure it in the adapter if possible.

Can you please advise if we are missing something in our configuration or if this is a confirmed bug you can fix.

Thank you

@geoffrich
Copy link
Owner

Hello! Can you please provide a minimal reproduction repo that shows the issue? the Svelte config is helpful but it's easiest to have a complete example

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

No branches or pull requests

2 participants