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

百度域下字体403 forbidden #1070

Closed
hxlniada opened this Issue Feb 24, 2016 · 16 comments

Comments

Projects
None yet
9 participants
@hxlniada

hxlniada commented Feb 24, 2016

百度内部的项目,发现访问字体的时候403 forbidden,
请问有什么方法通过么?

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

字体是托管在 http://iconfont.cn/ 上的,公网可用。是否网络环境有限制?

@hxlniada

This comment has been minimized.

hxlniada commented Feb 24, 2016

不是,我就是把host配成xx.baidu.com。就不行了

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

看下网络请求是否有错误,控制台是否有字体文件跨域相关的报错。

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

貌似是有这个问题,我正在咨询相关人员。

@insekkei

This comment has been minimized.

insekkei commented Feb 24, 2016

@hxlniada,我已经下载到本地使用...src/common/lib.js中的css引用路径改一下,然后把antd/lib/index.css copy出来,里面的字体路径都修改下...

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

@afc163

This comment has been minimized.

Member

afc163 commented Feb 24, 2016

alicdn 对百度域做了访问限制,先按本地部署来解决。

@afc163 afc163 closed this Feb 24, 2016

@someok

This comment has been minimized.

someok commented Feb 24, 2016

这个其实是因为字体图标的 url 采用的前缀是 //at.xxx

可以创建一个开发环境下的 less:

@import "~antd/style/index.less";

@import "custom.less";

@icon-url: "http://at.alicdn.com/t/font_1452596235_7047422";

On Wed, Feb 24, 2016 at 6:12 PM 偏右 notifications@github.com wrote:

Closed #1070 #1070.


Reply to this email directly or view it on GitHub
#1070 (comment).

@fengmk2

This comment has been minimized.

Contributor

fengmk2 commented Mar 1, 2016

尴尬。。。

@Flourad

This comment has been minimized.

Flourad commented Mar 16, 2016

http://ant.design/docs/resource/download下载web font放在项目目录下引用之后,怎么在代码里引用图标?按照原来的方式这样,图标无法显示?

@Dafrok

This comment has been minimized.

Contributor

Dafrok commented Jul 20, 2016

alicdn除了百度域还对别的域做限制吗……最好有个black list 以免耽误不必要的时间排查此类问题

@afc163

This comment has been minimized.

Member

afc163 commented Jul 20, 2016

这个我们也不了解。。。

@ghost

This comment has been minimized.

ghost commented Aug 17, 2016

image
还真是对百度域拦截了

@yankun01

This comment has been minimized.

yankun01 commented Sep 12, 2016

我累个去。。。。

@a-jie

This comment has been minimized.

a-jie commented Sep 6, 2017

使用StringReplacePlugin,就可以一步绕过吧

{
    test: /\.(css|less|js|jsx)$/,
        loader: StringReplacePlugin.replace({
            replacements: [
                {
                    pattern: new RegExp('https://at.alicdn.com/t/', 'ig'),
                    replacement: function (match, p1, offset, string) {
                        return '/assets/fonts/';
                    }
                }
            ]
        })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment