Nextjs15 app router deployed on IIS throws forbidden Access is denied on page refresh #80622
Unanswered
chukwudinweze
asked this question in
Help
Replies: 1 comment
-
Could you add one more condition: <rule name="Rewrite to .html" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="\.html$" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.html" />
</rule> I think you probably want to map non matches to 404.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Context, I deployed a statically exported Next.js 14 app to IIS. Output was generated using next export, resulting in this structure:
Navigating via links like /dashboard/transactions works fine in the browser. But refreshing that page or accessing it directly throws: You do not have permission to view this directory or page using the credentials that you supplied.
If I manually add .html to the refreshed url (e.g., /dashboard/transactions.html), it works perfectly.
Below is my current web.config in root (C:\inetpub\wwwroot\Nextjs14App\web.config):
I’ve confirmed:
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions