Browser-sync: Cannot GET url with dots in the query parameter value

Created on 2 Mar 2015  路  4Comments  路  Source: BrowserSync/browser-sync

Hi. I am currently receiving this error when trying to GET a url with '.' in the query parameter value:

Cannot GET /index.html?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjp7ImZhbWlseU5hbWUiOiJNb29yZSIsImdpdmVuTmFtZSI6IkRtaXRyaSJ9LCJlbWFpbCI6ImRlbWlzeGJhckBnbWFpbC5jb20iLCJpYXQiOjE0MjUzMzA3NjUsImV4cCI6MTQyNTMzNDM2NX0.aGoefGJ0OiCCRAYoBItoU927wdMq7CLGKux-gEJkK00

Delete two dots in the jwt parameter value makes the error go away. Is there any way to make it work in browser-sync built-in server, since JWT tokens are URL safe?

Most helpful comment

Actually, I think the fault lies with the middleware lite-server was using, connect-history-api-fallback.

This is the culprit:

   if (parsedUrl.pathname.indexOf('.') !== -1) {
      logger(
        'Not rewriting',
        req.method,
        req.url,
        'because the path includes a dot (.) character.'
      );
      return next();
    }

I will raise an issue about it there, and write my own middleware in the meantime.

Sorry for raising the issue in the wrong repo!

All 4 comments

I cannot reproduce this on version 2.5.2

Please feel free to create a sample project that can reproduce this error & we can take a look at it :)

I have the same issue, but it doesn't have to be in the query parameter, e.g.:

http://localhost:8080/email/verify/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjU2YTA1NjMwMjEyNTEzMDcxYzhkZjk5ZSIsImlhdCI6MTQ1NDAyNzU3NywiZXhwIjoxNDU0MjAwMzc3LCJhdWQiOiJodHRwOi8vYm9va2luZ3Byby5uei9hcHAiLCJpc3MiOiJodHRwOi8vYm9va2luZ3Byby5uei9hcGkifQ.VaTeu7ZxepyOiHI3DtFFw0iqzBY7lzVa22lfQKxRsHM

results in:

Cannot GET /email/verify/eyJ0eXAi........

Removing the dot correctly loads the Angular page. This was never an issue when I used to server my front-end app with Express.

This is with the latest BS version.

@shakyShane could you reopen this issue, or do you want me to create a new issue for it?

Actually, I think the fault lies with the middleware lite-server was using, connect-history-api-fallback.

This is the culprit:

   if (parsedUrl.pathname.indexOf('.') !== -1) {
      logger(
        'Not rewriting',
        req.method,
        req.url,
        'because the path includes a dot (.) character.'
      );
      return next();
    }

I will raise an issue about it there, and write my own middleware in the meantime.

Sorry for raising the issue in the wrong repo!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielverejan picture danielverejan  路  3Comments

jitendravyas picture jitendravyas  路  4Comments

Hurtak picture Hurtak  路  3Comments

codeofsumit picture codeofsumit  路  3Comments

w88975 picture w88975  路  3Comments