Issue 1:
I have searched the issues of this repository and believe that this is not a duplicate.

In my environment -- and it's unfortunately restricted to it, I can't reproduce it in an example -- I have the problem that all my redirects are done correctly and the server acts like expected with custom routing, but, the pages are loaded normally, not via in-place replacement (AJAX). So no XHR will be done on click on a link, instead the entire page gets reloaded.

How can I debug such an issue? Are there any common pitfalls? Do you have tips to find the issue? Any help is highly appreciated.

Just to show some code in case it's easy to find the issue, here's my server code:

const express = require('express');
const next = require('next');
const {parse} = require('url');
const i18nextMiddleware = require('i18next-express-middleware');
const Backend = require('i18next-node-fs-backend');
const i18n = require('../hoc/i18n');

const port = parseInt(process.env.APP_PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({dev});
const handle = app.getRequestHandler();

// init i18next with server-side settings
// using i18next-express-middleware
i18n.use(Backend).use(i18nextMiddleware.LanguageDetector).init({
preload: ['en', 'de'],
ns: ['common', 'home', 'content'],
backend: {
loadPath: __dirname + '/../locales/{{lng}}/{{ns}}.json',
addPath: __dirname + '/../locales/{{lng}}/{{ns}}-missing.json',
jsonIndent: 2
}
}, () => {
app.prepare().then(() => {
const server = express();

// Translation routing
server.use(i18nextMiddleware.handle(i18n));
server.use('/locales', express.static(__dirname + '/../locales'));
server.post('/locales/add/:lng/:ns', i18nextMiddleware.missingKeyHandler(i18n));

// Application Routing
server.get('*', (req, res) => {
// Be sure to pass `true` as the second argument to `url.parse`.
// This tells it to parse the query portion of the URL.
const parsedUrl = parse(req.url, true);
const {pathname, query} = parsedUrl;

if (pathname.startsWith('/_next')) {
return handle(req, res, parsedUrl);
} else if (pathname === '/') {
return app.render(req, res, '/', query);
} else {
return app.render(req, res, '/content', query);
}
});

server.listen(port, err => {
if (err) {
throw err;
}
console.log(`> Application server ready on http://localhost:${port}`);
});
})
});

Context

Navigating pages via AJAX.

Your Environment

Tech
Version

next
5.0.0

node
6.11.3

OS
Win 10

browser
Chrome & FF latest

etc

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I love the new static HTML export functionality in next 3.x, but it is behaving somewhat differently than I would expect. If you have a next.config.js that looks like this:

// next.config.js
module.exports = {
exportPathMap: function() {
return {
"/": {page: "/"},
"/page2": {page: "/page2"},
};
},
};

then I would expect next export to create an out directory like this:

index.html
page2.html

and I would expect Link components that link to /page2 to result in URLs that link to /page2.

Current Behavior

Instead, the config above produces an out directory like this:

index.html
page2/index.html

and Link components that link to /page2 result in URLs that link to /page2/.

Context

I'm trying to make a next site that can be easily hosted on a static server, but this feature means that all of the URLs in the site have an unnecessary trailing slash. This is not only a bit unsightly, but it's also not the same behavior as next start.

Your Environment

Tech
Version

next
3.0.6

node
8.2.1

OS
macOS Sierra

browser
N/A

etc