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

Asset name with ~ (6G Firewall - 403 error) #1243

Open
deeppresentation opened this issue Oct 18, 2021 · 3 comments
Open

Asset name with ~ (6G Firewall - 403 error) #1243

deeppresentation opened this issue Oct 18, 2021 · 3 comments

Comments

@deeppresentation
Copy link

Would it be possible to remove '~' symbol from asset name? One of my customer of wp plugin, that I sell is complaining about that. Sending an info from him:

We use a bunch of rules in .htaccess to block malicious requests. For more info, please have a look here.
One of these rules is as follow: (# 6G:[REQUEST STRINGS])
RedirectMatch 403 (?i)(~|`|<|>|:|;|,|%|\|\s|{|}|[|]||)

Thank you

@swashata
Copy link
Owner

swashata commented Dec 5, 2021

Hello,

It surely is possible. I would greatly appreciate a PR and guide you through the process. Basically you'd want the asset name generation to be configurable here in this file

https://github.com/swashata/wp-webpack-script/blob/master/packages/scripts/src/config/WebpackConfigHelper.ts

@deeppresentation
Copy link
Author

deeppresentation commented Dec 17, 2021 via email

@Rados51
Copy link

Rados51 commented Feb 5, 2022

@deeppresentation

You can use this inside of the wpackio.project.js

webpackConfig: (config, merge, appDir, isDev) => {
  const customRule = {
    optimization: {
      splitChunks: {
        chunks: "all",
        cacheGroups: {
          commons: {
            test: /[\\/]node_modules[\\/]/,
            name(module, chunks, cacheGroupKey) {
              if (isDev) return "vendors";
              const moduleFileName = module
                .identifier()
                .split("/")
                .reduceRight((item) => item);
              const allChunksNames = chunks.map((item) => item.name).join("-");
              return `${cacheGroupKey}-${allChunksNames}-${moduleFileName}`;
            },
            chunks: "all",
            minSize: 0,
          },
        },
      },
    },
  };
  return merge(config, customRule);
}

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

3 participants